blob: 92a86e9cbdd86b0abcb55d6977a457a55db3f15e [file] [log] [blame]
<!doctype html><html lang=cn class=no-js><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=generator content="Hugo 0.102.3"><link rel=canonical type=text/html href=/cn/docs/><link rel=alternate type=application/rss+xml href=/cn/docs/index.xml><meta name=robots content="noindex, nofollow"><link rel="shortcut icon" href=/favicons/favicon.ico><link rel=apple-touch-icon href=/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/favicons/android-96x96.png sizes=96x96><link rel=icon type=image/png href=/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/favicons/android-192x192.png sizes=192x192><title>Documentation | HugeGraph</title><meta name=description content="欢迎阅读HugeGraph文档
"><meta property="og:title" content="Documentation"><meta property="og:description" content="Apache HugeGraph 官网"><meta property="og:type" content="website"><meta property="og:url" content="/cn/docs/"><meta property="og:site_name" content="HugeGraph"><meta itemprop=name content="Documentation"><meta itemprop=description content="Apache HugeGraph 官网"><meta name=twitter:card content="summary"><meta name=twitter:title content="Documentation"><meta name=twitter:description content="Apache HugeGraph 官网"><link rel=preload href=/scss/main.min.14ea575cb35d93d46ff8681b2334f40fd46243c100c5c39f5a841b931fae2d40.css as=style><link href=/scss/main.min.14ea575cb35d93d46ff8681b2334f40fd46243c100c5c39f5a841b931fae2d40.css rel=stylesheet integrity><script src=https://code.jquery.com/jquery-3.5.1.min.js integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin=anonymous></script>
<link rel=stylesheet href=/css/prism.css><script type=application/javascript>var doNotTrack=!1;doNotTrack||(window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-00000000-0","auto"),ga("send","pageview"))</script><script async src=https://www.google-analytics.com/analytics.js></script></head><body class=td-section><header><nav class="js-navbar-scroll navbar navbar-expand navbar-dark flex-column flex-md-row td-navbar"><a class=navbar-brand href=/cn/><span class=navbar-logo><svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-miterlimit:10;stroke-width:.5px;opacity:.3}.cls-2{fill:#229efa}.cls-3{fill:#9948f7}.cls-4{fill:#33bc7a}.cls-5{fill:url(#未命名的渐变_3)}.cls-6{fill:url(#未命名的渐变_13)}.cls-7{fill:url(#未命名的渐变_11)}</style><linearGradient id="未命名的渐变_3" x1="6.16" y1="14.63" x2="6.16" y2="6.01" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2e3192"/><stop offset="0" stop-color="#229efa"/><stop offset=".44" stop-color="#239cf8"/><stop offset=".6" stop-color="#2795f2"/><stop offset=".71" stop-color="#2d8ae8"/><stop offset=".81" stop-color="#3679d9"/><stop offset=".89" stop-color="#4263c6"/><stop offset=".95" stop-color="#5048af"/><stop offset="1" stop-color="#5c319b"/></linearGradient><linearGradient id="未命名的渐变_13" x1="10.75" y1="8.2" x2="4.49" y2="1.94" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#991146"/><stop offset="0" stop-color="#326b4e"/><stop offset=".02" stop-color="#3a685c"/><stop offset=".07" stop-color="#506180"/><stop offset=".13" stop-color="#645aa0"/><stop offset=".19" stop-color="#7554bc"/><stop offset=".26" stop-color="#8250d2"/><stop offset=".35" stop-color="#8d4ce3"/><stop offset=".45" stop-color="#944aee"/><stop offset=".6" stop-color="#9848f5"/><stop offset="1" stop-color="#9948f7"/></linearGradient><linearGradient id="未命名的渐变_11" x1="15.34" y1="6.67" x2="7.88" y2="10.98" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#33bc7a"/><stop offset=".45" stop-color="#32ba7a"/><stop offset=".61" stop-color="#2fb37c"/><stop offset=".73" stop-color="#29a87e"/><stop offset=".82" stop-color="#219782"/><stop offset=".9" stop-color="#168186"/><stop offset=".97" stop-color="#09668b"/><stop offset="1" stop-color="#03598e"/></linearGradient></defs><title>logo</title><rect class="cls-1" x="-143.14" y="-373.46" width="597.8" height="424.44"/><circle class="cls-2" cx="12.02" cy="1.83" r="1.33"/><circle class="cls-3" cx="12.02" cy="14.17" r="1.33"/><circle class="cls-4" cx="1.33" cy="8" r="1.33"/><path class="cls-5" d="M7.91 10h0a2.65 2.65.0 01-.23-3.74A1.75 1.75.0 017.91 6h0A2.66 2.66.0 014.4 6h0a1.81 1.81.0 01.24.24A2.65 2.65.0 014.4 10h0a2.62 2.62.0 00-.89 2 2.65 2.65.0 104.4-2z"/><path class="cls-6" d="M12.19 5.49a2.78 2.78.0 01-.5.11A2.64 2.64.0 018.76 3.5h0a2.65 2.65.0 10-2.6 3.17A2.6 2.6.0 007 6.53H7a2.65 2.65.0 013.44 2 2.94 2.94.0 010-.51 2.65 2.65.0 011.75-2.53z"/><path class="cls-7" d="M13 5.35a2.64 2.64.0 00-2.59 2.12h0a3 3 0 01-.08.32A2.65 2.65.0 017.54 9.58a2.86 2.86.0 00.37.41h0a2.63 2.63.0 01.9 2 2.84 2.84.0 01-.05.51 2.64 2.64.0 013.12-2.06l.32.08h0a2.6 2.6.0 00.84.14 2.65 2.65.0 100-5.3z"/></svg></span><span class=font-weight-bold>HugeGraph</span></a><div class="td-navbar-nav-scroll ml-md-auto" id=main_navbar><ul class="navbar-nav mt-2 mt-lg-0"><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/cn/docs/><i class='fas fa-book pr-2'></i><span>Documentation</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=https://github.com/apache/incubator-hugegraph target=_blank><i class='fab fa-github pr-2'></i><span>GitHub</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/cn/docs/download/download/><i class='fas fa-download pr-2'></i><span>Download</span></a></li><li class="nav-item mr-4 mb-2 mb-lg-0"><a class=nav-link href=/cn/community/><span>Community</span></a></li><li class="nav-item dropdown mr-4 d-none d-lg-block"><a class="nav-link dropdown-toggle" href=# id=navbarDropdown role=button data-toggle=dropdown aria-haspopup=true aria-expanded=false>中文</a><div class=dropdown-menu aria-labelledby=navbarDropdownMenuLink><a class=dropdown-item href=/docs/>English</a></div></li></ul></div><div class="navbar-nav d-none d-lg-block"></div></nav></header><div class="container-fluid td-outer"><div class=td-main><div class="row flex-xl-nowrap"><main class="col-12 col-md-9 col-xl-8 pl-md-5" role=main><div class=td-content><div class="pageinfo pageinfo-primary d-print-none"><p>This is the multi-page printable view of this section.
<a href=# onclick="return print(),!1">Click here to print</a>.</p><p><a href=/cn/docs/>Return to the regular view of this page</a>.</p></div><h1 class=title>Documentation</h1><ul><li>1: <a href=#pg-7dd24b6126e5b249f96de862bfc51025>Introduction with HugeGraph</a></li><li>2: <a href=#pg-64d47cfe1880443239e7c31f8fd1ac1a>下载 Apache HugeGraph (Incubating)</a></li><li>3: <a href=#pg-08b1b69f6319108b0455d24614fdd660>Quick Start</a></li><ul><li>3.1: <a href=#pg-8ec2ee5fd8ff8e48255d55eab65d92b6>HugeGraph-Server Quick Start</a></li><li>3.2: <a href=#pg-685a02f8811d86f1ce195d7c73d9ea44>HugeGraph-Loader Quick Start</a></li><li>3.3: <a href=#pg-751ed124ec6dbb96d5e65c62dc9d4e85>HugeGraph-Hubble Quick Start</a></li><li>3.4: <a href=#pg-405910066a042ce44a1c5798042ab119>HugeGraph-AI Quick Start</a></li><li>3.5: <a href=#pg-9cbf1b01e876dc8cdc2da1c17759eed3>HugeGraph-Client Quick Start</a></li><li>3.6: <a href=#pg-06d4cae527789fcda01ebf4e48c6559f>HugeGraph-Tools Quick Start</a></li><li>3.7: <a href=#pg-e68a801476ae8ef5e45c79949a3a5e44>HugeGraph-Computer Quick Start</a></li></ul><li>4: <a href=#pg-5074334c73aa450364a31470231ebff8>Config</a></li><ul><li>4.1: <a href=#pg-af7e8f1dc385b255c4f38b3cbafe224a>HugeGraph 配置</a></li><li>4.2: <a href=#pg-6bfbb2db4e1f281942d741cef305e724>HugeGraph 配置项</a></li><li>4.3: <a href=#pg-7d189549d4201521c83e0d93a2474a2d>HugeGraph 内置用户权限与扩展权限配置及使用</a></li><li>4.4: <a href=#pg-7e400260398a18d0be72b1fe5a73f419>配置 HugeGraphServer 使用 https 协议</a></li><li>4.5: <a href=#pg-b22c66aa61d3c6e047af8286d3b5f445>HugeGraph-Computer 配置</a></li></ul><li>5: <a href=#pg-8f8368cdf9ec684d30761c6d28a34179>API</a></li><ul><li>5.1: <a href=#pg-a809bf70d5493b5046619919800e4de6>HugeGraph RESTful API</a></li><ul><li>5.1.1: <a href=#pg-698c3217de07a8cb0dc0e93dbae29ee9>Schema API</a></li><li>5.1.2: <a href=#pg-f7f4b3b6f4b7a965f8c30675df8e56f8>PropertyKey API</a></li><li>5.1.3: <a href=#pg-28cb205879be97a55ddc8cd365c4438e>VertexLabel API</a></li><li>5.1.4: <a href=#pg-41864d99c39fc7040549f6eaf5441daf>EdgeLabel API</a></li><li>5.1.5: <a href=#pg-7099742fb947ad5dfde9e72216c10b8a>IndexLabel API</a></li><li>5.1.6: <a href=#pg-bde129922f801ad9560757fcec64d05c>Rebuild API</a></li><li>5.1.7: <a href=#pg-86bf520fd6b098231f4af6590328e871>Vertex API</a></li><li>5.1.8: <a href=#pg-f40127b155ddd802d50c507ff1cf5530>Edge API</a></li><li>5.1.9: <a href=#pg-f0adc653be0b454ce1952bdaf0afefa6>Traverser API</a></li><li>5.1.10: <a href=#pg-ced5167413a6606a537e40b18f6fec3e>Rank API</a></li><li>5.1.11: <a href=#pg-32aff6fa72d51caa846c2a72e5771c5d>Variable API</a></li><li>5.1.12: <a href=#pg-3d75cf337650cd90a617c3ef7e9dca87>Graphs API</a></li><li>5.1.13: <a href=#pg-d9de752e44e3a8a709d187e4101fd818>Task API</a></li><li>5.1.14: <a href=#pg-e84b0f106294b580ca64918b72cc71d1>Gremlin API</a></li><li>5.1.15: <a href=#pg-f7fe8b1685038d0062b4c806247e1db4>Cypher API</a></li><li>5.1.16: <a href=#pg-a3b125f257052209fcb98300d5c066a7>Authentication API</a></li><li>5.1.17: <a href=#pg-db6682f721f1c345d19274e452d1d3d3>Metrics API</a></li><li>5.1.18: <a href=#pg-8e126d4f2f7317a1268d7edb65cd4fcc>Other API</a></li></ul><li>5.2: <a href=#pg-3457a7585a93814fdbb1a44b68edc0d3>HugeGraph Java Client</a></li><li>5.3: <a href=#pg-1ebf9ecb86d8a6b8536fd581e696ce8c>Gremlin-Console</a></li></ul><li>6: <a href=#pg-d2c6535126cca927d2a9c893abde92a0>GUIDES</a></li><ul><li>6.1: <a href=#pg-dcb89d888ea6f4146ace522d76fe2776>HugeGraph Architecture Overview</a></li><li>6.2: <a href=#pg-3d0f9ef831ef5d7d11acfb09140359fa>HugeGraph Design Concepts</a></li><li>6.3: <a href=#pg-96a920d19e01666d95eded506d502ab4>HugeGraph Plugin 机制及插件扩展流程</a></li><li>6.4: <a href=#pg-2c9db416c8d78f898d52c91ec12535d4>Backup Restore</a></li><li>6.5: <a href=#pg-3465b699399f48689cdc6b5e59a10d69>FAQ</a></li><li>6.6: <a href=#pg-d54c862d45861ca39a945d90325e3909>报告安全问题</a></li></ul><li>7: <a href=#pg-3ed7a32fc6a58bb9d03dcd00dc874ba8>QUERY LANGUAGE</a></li><ul><li>7.1: <a href=#pg-2696905b5b6cbdf2ad7f78085bd6baa9>HugeGraph Gremlin</a></li><li>7.2: <a href=#pg-29164f631ea2ad7e883c0ba00a843508>HugeGraph Examples</a></li></ul><li>8: <a href=#pg-f0a22a813c843322c0d360d952e434ce>PERFORMANCE</a></li><ul><li>8.1: <a href=#pg-63f6d63db3ee3a5270fc1ca0a0c0e181>HugeGraph BenchMark Performance</a></li><li>8.2: <a href=#pg-699ebe5daed825049424b7539aad30f9>HugeGraph-API Performance</a></li><ul><li>8.2.1: <a href=#pg-dbfafc29a5e930415f78f72c47ee67f2>v0.5.6 Stand-alone(RocksDB)</a></li><li>8.2.2: <a href=#pg-fd5b165e28a07f1c35ab177b10e15dc8>v0.5.6 Cluster(Cassandra)</a></li></ul><li>8.3: <a href=#pg-8e73cd18ae7e460700391440de46c404>HugeGraph-Loader Performance</a></li><li>8.4: <a href=#pg-0b6ebbdbce17d47f26fcb874226e5edc></a></li></ul><li>9: <a href=#pg-99a93ef9534d11fef4be3e4b3b1a6381>Contribution Guidelines</a></li><ul><li>9.1: <a href=#pg-17ea1d6a1e6627d08a7d6f4d2898cca1>如何参与 HugeGraph 社区</a></li><li>9.2: <a href=#pg-dc89ef117bed0b0ef3c6487f9a6a8bd0>订阅社区邮箱</a></li><li>9.3: <a href=#pg-07536ba8fd0a4ba5975f821978cf0009>验证 Apache 发版</a></li><li>9.4: <a href=#pg-c89774a4e231af418639f53a926ea188>在 IDEA 中配置 Server 开发环境</a></li><li>9.5: <a href=#pg-e1fc3666faccec72ead94a2ed6a9f8a3>Apache HugeGraph Committer 指南</a></li></ul><li>10: <a href=#pg-d9ec0777c4f7a8a41476a65f2ecca6f7>CHANGELOGS</a></li><ul><li>10.1: <a href=#pg-6b37a0af49c5e6b45aeac03f2a71eab6>HugeGraph 0.12 Release Notes</a></li><li>10.2: <a href=#pg-e45a1f0eaa721babce18f07eaf5fc437>HugeGraph 1.0.0 Release Notes</a></li><li>10.3: <a href=#pg-683dacb0fb9a0e0d70537cae5afdb7cf>HugeGraph 1.2.0 Release Notes</a></li><li>10.4: <a href=#pg-cc8446bbcef27957e4ec28e70811ad2f>HugeGraph 1.3.0 Release Notes</a></li></ul><li>11: <a href=#pg-01c617939d9e21dc19567e8753d6fd3b></a></li><li>12: <a href=#pg-a395eab4dc054c73b0174216cfbeaf1a></a></li></ul><div class=content><p>欢迎阅读HugeGraph文档</p></div></div><div class=td-content><h1 id=pg-7dd24b6126e5b249f96de862bfc51025>1 - Introduction with HugeGraph</h1><h3 id=summary>Summary</h3><p>Apache HugeGraph 是一款易用、高效、通用的开源图数据库系统(Graph Database,<a href=https://github.com/apache/hugegraph>GitHub 项目地址</a>),
实现了<a href=https://tinkerpop.apache.org>Apache TinkerPop3</a>框架及完全兼容<a href=https://tinkerpop.apache.org/gremlin.html>Gremlin</a>查询语言,
具备完善的工具链组件,助力用户轻松构建基于图数据库之上的应用和产品。HugeGraph 支持百亿以上的顶点和边快速导入,并提供毫秒级的关联关系查询能力(OLTP),
并支持大规模分布式图分析(OLAP)。</p><p>HugeGraph 典型应用场景包括深度关系探索、关联分析、路径搜索、特征抽取、数据聚类、社区检测、知识图谱等,
适用业务领域有如网络安全、电信诈骗、金融风控、广告推荐、社交网络和智能机器人等。</p><p>本系统的主要应用场景是解决反欺诈、威胁情报、黑产打击等业务的图数据存储和建模分析需求,在此基础上逐步扩展及支持了更多的通用图应用。</p><h3 id=features>Features</h3><p>HugeGraph 支持在线及离线环境下的图操作,支持批量导入数据,支持高效的复杂关联关系分析,并且能够与大数据平台无缝集成。
HugeGraph 支持多用户并行操作,用户可输入 Gremlin 查询语句,并及时得到图查询结果,也可在用户程序中调用 HugeGraph API 进行图分析或查询。</p><p>本系统具备如下特点:</p><ul><li>易用:HugeGraph 支持 Gremlin 图查询语言与 RESTful API,同时提供图检索常用接口,具备功能齐全的周边工具,轻松实现基于图的各种查询分析运算。</li><li>高效:HugeGraph 在图存储和图计算方面做了深度优化,提供多种批量导入工具,轻松完成百亿级数据快速导入,通过优化过的查询达到图检索的毫秒级响应。支持数千用户并发的在线实时操作。</li><li>通用:HugeGraph 支持 Apache Gremlin 标准图查询语言和 Property Graph 标准图建模方法,支持基于图的 OLTP 和 OLAP 方案。集成 Apache Hadoop 及 Apache Spark 大数据平台。</li><li>可扩展:支持分布式存储、数据多副本及横向扩容,内置多种后端存储引擎,也可插件式轻松扩展后端存储引擎。</li><li>开放:HugeGraph 代码开源(Apache 2 License),客户可自主修改定制,选择性回馈开源社区。</li></ul><p>本系统的功能包括但不限于:</p><ul><li>支持从多数据源批量导入数据 (包括本地文件、HDFS 文件、MySQL 数据库等数据源),支持多种文件格式导入 (包括 TXT、CSV、JSON 等格式)</li><li>具备可视化操作界面,可用于操作、分析及展示图,降低用户使用门槛</li><li>优化的图接口:最短路径 (Shortest Path)、K 步连通子图 (K-neighbor)、K 步到达邻接点 (K-out)、个性化推荐算法 PersonalRank 等</li><li>基于 Apache TinkerPop3 框架实现,支持 Gremlin 图查询语言</li><li>支持属性图,顶点和边均可添加属性,支持丰富的属性类型</li><li>具备独立的 Schema 元数据信息,拥有强大的图建模能力,方便第三方系统集成</li><li>支持多顶点 ID 策略:支持主键 ID、支持自动生成 ID、支持用户自定义字符串 ID、支持用户自定义数字 ID</li><li>可以对边和顶点的属性建立索引,支持精确查询、范围查询、全文检索</li><li>存储系统采用插件方式,支持 RocksDB(单机/集群)、Cassandra、ScyllaDB、HBase、MySQL、PostgreSQL、Palo 以及 Memory 等</li><li>与 HDFS、Spark/Flink、GraphX 等大数据系统集成,支持 BulkLoad 操作导入海量数据</li><li>支持高可用 HA、数据多副本、备份恢复、监控、分布式 Trace 等</li></ul><h3 id=modules>Modules</h3><ul><li><a href=/cn/docs/quickstart/hugegraph-server>HugeGraph-Server</a>: HugeGraph-Server 是 HugeGraph 项目的核心部分,包含 Core、Backend、API 等子模块;<ul><li>Core:图引擎实现,向下连接 Backend 模块,向上支持 API 模块;</li><li>Backend:实现将图数据存储到后端,支持的后端包括:Memory、Cassandra、ScyllaDB、RocksDB、HBase、MySQL 及 PostgreSQL,用户根据实际情况选择一种即可;</li><li>API:内置 REST Server,向用户提供 RESTful API,同时完全兼容 Gremlin 查询。(支持分布式存储和计算下推)</li></ul></li><li><a href=https://github.com/apache/hugegraph-toolchain>HugeGraph-Toolchain</a>: (工具链)<ul><li><a href=/cn/docs/quickstart/hugegraph-client>HugeGraph-Client</a>:HugeGraph-Client 提供了 RESTful API 的客户端,用于连接 HugeGraph-Server,目前仅实现 Java 版,其他语言用户可自行实现;</li><li><a href=/cn/docs/quickstart/hugegraph-loader>HugeGraph-Loader</a>:HugeGraph-Loader 是基于 HugeGraph-Client 的数据导入工具,将普通文本数据转化为图形的顶点和边并插入图形数据库中;</li><li><a href=/cn/docs/quickstart/hugegraph-hubble>HugeGraph-Hubble</a>:HugeGraph-Hubble 是 HugeGraph 的 Web
可视化管理平台,一站式可视化分析平台,平台涵盖了从数据建模,到数据快速导入,再到数据的在线、离线分析、以及图的统一管理的全过程;</li><li><a href=/cn/docs/quickstart/hugegraph-tools>HugeGraph-Tools</a>:HugeGraph-Tools 是 HugeGraph 的部署和管理工具,包括管理图、备份/恢复、Gremlin 执行等功能。</li></ul></li><li><a href=/cn/docs/quickstart/hugegraph-computer>HugeGraph-Computer</a>:HugeGraph-Computer 是分布式图处理系统 (OLAP).
它是 <a href=https://kowshik.github.io/JPregel/pregel_paper.pdf>Pregel</a> 的一个实现。它可以运行在 Kubernetes/Yarn
等集群上,支持超大规模图计算。</li><li><a href=/cn/docs/quickstart/hugegraph-ai>HugeGraph-AI</a>:HugeGraph-AI 是 HugeGraph 独立的 AI
组件,提供了图神经网络的训练和推理功能,LLM/Graph RAG 结合/Python-Client 等相关组件,持续更新 ing。</li></ul><h3 id=contact-us>Contact Us</h3><ul><li><a href=https://github.com/apache/incubator-hugegraph/issues>GitHub Issues</a>: 使用途中出现问题或提供功能性建议,可通过此反馈 (推荐)</li><li>邮件反馈:<a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a> (<a href=https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/>邮箱订阅方式</a>)</li><li>SEC 反馈: <a href=mailto:security@hugegraph.apache.org>security@hugegraph.apache.org</a> (报告安全相关问题)</li><li>微信公众号:Apache HugeGraph, 欢迎扫描下方二维码加入我们!</li></ul><img src="https://github.com/apache/hugegraph-doc/blob/master/assets/images/wechat.png?raw=true" alt="QR png" width=300></div><div class=td-content style=page-break-before:always><h1 id=pg-64d47cfe1880443239e7c31f8fd1ac1a>2 - 下载 Apache HugeGraph (Incubating)</h1><blockquote><p>指南:</p><ul><li>推荐使用最新版本的 HugeGraph 软件包, 运行时环境请选择 Java11</li><li>验证下载版本, 请使用相应的哈希 (SHA512)、签名和 <a href=https://downloads.apache.org/incubator/hugegraph/KEYS>项目签名验证 KEYS</a></li><li>检查哈希 (SHA512)、签名的说明在 <a href=/docs/contribution-guidelines/validate-release/>版本验证</a> 页面, 也可参考 <a href=https://www.apache.org/dyn/closer.cgi#verify>ASF 验证说明</a></li></ul></blockquote><blockquote><p>注: HugeGraph 所有组件版本号已保持一致, <code>client/loader/hubble/common</code> 等 maven 仓库版本号同理, 依赖引用可参考 <a href=https://github.com/apache/incubator-hugegraph-toolchain#maven-dependencies>maven 示例</a></p></blockquote><h3 id=最新版本-130>最新版本 1.3.0</h3><ul><li>Release Date: 2024-04-01</li><li><a href=/docs/changelog/hugegraph-1.3.0-release-notes/>Release Notes</a></li></ul><h4 id=二进制包>二进制包</h4><table><thead><tr><th>Server</th><th>Toolchain</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><h4 id=源码包>源码包</h4><p>Please refer to <a href=/docs/quickstart/hugegraph-server/>build from source</a>.</p><table><thead><tr><th>Server</th><th>Toolchain</th><th>AI</th><th>Common</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-incubating-1.3.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-ai-incubating-1.3.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-ai-incubating-1.3.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-ai-incubating-1.3.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.3.0/apache-hugegraph-commons-incubating-1.3.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-commons-incubating-1.3.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-commons-incubating-1.3.0-src.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><hr><h3 id=归档版本>归档版本</h3><blockquote><p>注:</p><ol><li>请大家尽早迁移到最新 Release 版本上, 社区将不再维护 <code>1.0.0</code> 前的旧版本 (非 ASF 版本)</li><li><code>1.3.0</code> 是最后一个兼容 Java8 的主版本, 请尽早使用/迁移运行时为 Java11 (低版本 Java 有潜在更多的 SEC 风险和性能影响)</li></ol></blockquote><h4 id=120>1.2.0</h4><ul><li>Release Date: 2023-12-28</li><li><a href=/docs/changelog/hugegraph-1.2.0-release-notes/>Release Notes</a></li></ul><h5 id=二进制包-1>二进制包</h5><table><thead><tr><th>Server</th><th>Toolchain</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><h5 id=源码包-1>源码包</h5><table><thead><tr><th>Server</th><th>Toolchain</th><th>Computer</th><th>Common</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-incubating-1.2.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-toolchain-incubating-1.2.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-computer-incubating-1.2.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-computer-incubating-1.2.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-computer-incubating-1.2.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.2.0/apache-hugegraph-commons-incubating-1.2.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-commons-incubating-1.2.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.2.0/apache-hugegraph-commons-incubating-1.2.0-src.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><h4 id=100>1.0.0</h4><ul><li>Release Date: 2023-02-22</li><li><a href=/docs/changelog/hugegraph-1.0.0-release-notes/>Release Notes</a></li></ul><h5 id=二进制包-2>二进制包</h5><table><thead><tr><th>Server</th><th>Toolchain</th><th>Computer</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0.tar.gz?action=download">Binary</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><h5 id=源码包-2>源码包</h5><table><thead><tr><th>Server</th><th>Toolchain</th><th>Computer</th><th>Common</th></tr></thead><tbody><tr><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-incubating-1.0.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-computer-incubating-1.0.0-src.tar.gz.sha512>SHA512</a>]</td><td>[<a href="https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.0.0/apache-hugegraph-commons-incubating-1.0.0-src.tar.gz?action=download">Source</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-commons-incubating-1.0.0-src.tar.gz.asc>Sign</a>] [<a href=https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-commons-incubating-1.0.0-src.tar.gz.sha512>SHA512</a>]</td></tr></tbody></table><hr><details><summary>旧版本 (非 ASF 版本)</summary>
由于 ASF 规则要求, 不能直接在当前页面存放非 ASF 发行包, 对于 1.0.0 前旧版本 (非 ASF 版本) 的下载说明, 请跳转至 https://github.com/apache/incubator-hugegraph-doc/wiki/Apache-HugeGraph-(Incubating)-Old-Versions-Download</details></div><div class=td-content style=page-break-before:always><h1 id=pg-08b1b69f6319108b0455d24614fdd660>3 - Quick Start</h1></div><div class=td-content><h1 id=pg-8ec2ee5fd8ff8e48255d55eab65d92b6>3.1 - HugeGraph-Server Quick Start</h1><h3 id=1-hugegraph-server-概述>1 HugeGraph-Server 概述</h3><p>HugeGraph-Server 是 HugeGraph 项目的核心部分,包含 Core、Backend、API 等子模块。</p><p>Core 模块是 Tinkerpop 接口的实现,Backend 模块用于管理数据存储,目前支持的后端包括:Memory、Cassandra、ScyllaDB 以及 RocksDB,API 模块提供 HTTP Server,将 Client 的 HTTP 请求转化为对 Core 的调用。</p><blockquote><p>文档中会出现 <code>HugeGraph-Server</code><code>HugeGraphServer</code> 这两种写法,其他组件也类似。
这两种写法含义上并明显差异,可以这么区分:<code>HugeGraph-Server</code> 表示服务端相关组件代码,<code>HugeGraphServer</code> 表示服务进程。</p></blockquote><h3 id=2-依赖>2 依赖</h3><h4 id=21-安装-java-11-jdk-11>2.1 安装 Java 11 (JDK 11)</h4><p>请优先考虑在 Java 11 的环境上启动 <code>HugeGraph-Server</code>(在 1.5.0 版前,会保留对 Java 8 的基本兼容)</p><p><strong>在往下阅读之前先执行 <code>java -version</code> 命令确认 jdk 版本</strong></p><blockquote><p>注:使用 Java 8 启动 HugeGraph-Server 会失去一些<strong>安全性</strong>的保障,也会降低性能相关指标</p><p>我们推荐生产或对外网暴露访问的环境使用 Java 11 并考虑开启 <a href=/cn/docs/config/config-authentication/>Auth 权限认证</a></p></blockquote><h3 id=3-部署>3 部署</h3><p>有四种方式可以部署 HugeGraph-Server 组件:</p><ul><li>方式 1:使用 Docker 容器 (便于<strong>测试</strong>)</li><li>方式 2:下载 tar 包</li><li>方式 3:源码编译</li><li>方式 4:使用 tools 工具部署 (Outdated)</li></ul><h4 id=31-使用-docker-容器-便于测试>3.1 使用 Docker 容器 (便于<strong>测试</strong>)</h4><p>可参考 <a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/docker/README.md>Docker 部署方式</a></p><p>我们可以使用 <code>docker run -itd --name=server -p 8080:8080 hugegraph/hugegraph</code> 去快速启动一个内置了 <code>RocksDB</code><code>Hugegraph server</code>.</p><p>可选项:</p><ol><li>可以使用 <code>docker exec -it server bash</code> 进入容器完成一些操作</li><li>可以使用 <code>docker run -itd --name=server -p 8080:8080 -e PRELOAD="true" hugegraph/hugegraph</code> 在启动的时候预加载一个<strong>内置的</strong>样例图。可以通过 <code>RESTful API</code> 进行验证。具体步骤可以参考 <a href=/cn/docs/quickstart/hugegraph-server/#511-%E5%90%AF%E5%8A%A8-server-%E7%9A%84%E6%97%B6%E5%80%99%E5%88%9B%E5%BB%BA%E7%A4%BA%E4%BE%8B%E5%9B%BE>5.1.1</a></li><li>可以使用 <code>-e PASSWORD=123456</code> 设置是否开启鉴权模式以及 admin 的密码,具体步骤可以参考 <a href=/cn/docs/config/config-authentication#%E4%BD%BF%E7%94%A8-docker-%E6%97%B6%E5%BC%80%E5%90%AF%E9%89%B4%E6%9D%83%E6%A8%A1%E5%BC%8F>Config Authentication</a></li></ol><p>如果使用 docker desktop,则可以按照如下的方式设置可选项:</p><div style=text-align:center><img src=/docs/images/images-server/31docker-option.jpg alt=image style=width:33%></div><p>另外,如果我们希望能够在一个文件中管理除了 <code>server</code> 之外的其他 Hugegraph 相关的实例,我们也可以使用 <code>docker-compose</code>完成部署,使用命令 <code>docker-compose up -d</code>,(当然只配置 <code>server</code> 也是可以的)以下是一个样例的 <code>docker-compose.yml</code>:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;3&#39;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># environment:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># - PRELOAD=true 为可选参数,为 True 时可以在启动的时候预加载一个内置的样例图</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># - PASSWORD=123456 为可选参数,设置的时候可以开启鉴权模式,并设置密码</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><blockquote><p>注意:</p><ol><li><p>hugegraph 的 docker 镜像是一个便捷版本,用于快速启动 hugegraph,并不是<strong>官方发布物料包方式</strong>。你可以从 <a href=https://infra.apache.org/release-distribution.html#dockerhub>ASF Release Distribution Policy</a> 中得到更多细节。</p></li><li><p>推荐使用 <code>release tag</code>(如 <code>1.3.0</code>) 以获取稳定版。使用 <code>latest</code> tag 可以使用开发中的最新功能。</p></li></ol></blockquote><h4 id=32-下载-tar-包>3.2 下载 tar 包</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># use the latest version, here is 1.3.0 for example</span>
</span></span><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>/apache-hugegraph-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>.tar.gz
</span></span><span style=display:flex><span>tar zxf *hugegraph*.tar.gz
</span></span></code></pre></div><h4 id=33-源码编译>3.3 源码编译</h4><p>源码编译前请确保本机有安装 <code>wget/curl</code> 命令</p><p>下载 HugeGraph 源代码</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>git clone https://github.com/apache/hugegraph.git
</span></span></code></pre></div><p>编译打包生成 tar 包</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># (Optional) use &#34;-P stage&#34; param if you build failed with the latest code(during pre-release period)</span>
</span></span><span style=display:flex><span>mvn package -DskipTests
</span></span></code></pre></div><p>执行日志如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>......
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> Reactor Summary <span style=color:#204a87;font-weight:700>for</span> hugegraph 1.3.0:
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph .......................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 2.405 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-core ..................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 13.405 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-api ...................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 25.943 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-cassandra ................................ SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 54.270 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-scylladb ................................. SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 1.032 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-rocksdb .................................. SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 34.752 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-mysql .................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 1.778 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-palo ..................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 1.070 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-hbase .................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 32.124 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-postgresql ............................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 1.823 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-dist ..................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 17.426 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-example .................................. SUCCESS <span style=color:#ce5c00;font-weight:700>[</span> 1.941 s<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> hugegraph-test ..................................... SUCCESS <span style=color:#ce5c00;font-weight:700>[</span>01:01 min<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> ------------------------------------------------------------------------
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> BUILD SUCCESS
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> ------------------------------------------------------------------------
</span></span><span style=display:flex><span>......
</span></span></code></pre></div><p>执行成功后,在 hugegraph 目录下生成 <code>*hugegraph-*.tar.gz</code> 文件,就是编译生成的 tar 包。</p><h4 id=34-使用-tools-工具部署-outdated>3.4 使用 tools 工具部署 (Outdated)</h4><p>HugeGraph-Tools 提供了一键部署的命令行工具,用户可以使用该工具快速地一键下载、解压、配置并启动 HugeGraph-Server 和 HugeGraph-Hubble,最新的 HugeGraph-Toolchain 中已经包含所有的这些工具,直接下载它解压就有工具包集合了</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># download toolchain package, it includes loader + tool + hubble, please check the latest version (here is 1.3.0)</span>
</span></span><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/1.3.0/apache-hugegraph-toolchain-incubating-1.3.0.tar.gz
</span></span><span style=display:flex><span>tar zxf *hugegraph-*.tar.gz
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># enter the tool&#39;s package</span>
</span></span><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph*/*tool*
</span></span></code></pre></div><blockquote><p>注:<code>${version}</code> 为版本号,最新版本号可参考 <a href=/docs/download/download>Download 页面</a>,或直接从 Download 页面点击链接下载</p></blockquote><p>HugeGraph-Tools 的总入口脚本是 <code>bin/hugegraph</code>,用户可以使用 <code>help</code> 子命令查看其用法,这里只介绍一键部署的命令。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph deploy -v <span style=color:#ce5c00;font-weight:700>{</span>hugegraph-version<span style=color:#ce5c00;font-weight:700>}</span> -p <span style=color:#ce5c00;font-weight:700>{</span>install-path<span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#ce5c00;font-weight:700>[</span>-u <span style=color:#ce5c00;font-weight:700>{</span>download-path-prefix<span style=color:#ce5c00;font-weight:700>}]</span>
</span></span></code></pre></div><p><code>{hugegraph-version}</code> 表示要部署的 HugeGraphServer 及 HugeGraphStudio 的版本,用户可查看 <code>conf/version-mapping.yaml</code> 文件获取版本信息,<code>{install-path}</code> 指定 HugeGraphServer 及 HugeGraphStudio 的安装目录,<code>{download-path-prefix}</code> 可选,指定 HugeGraphServer 及 HugeGraphStudio tar 包的下载地址,不提供时使用默认下载地址,比如要启动 0.6 版本的 HugeGraph-Server 及 HugeGraphStudio 将上述命令写为 <code>bin/hugegraph deploy -v 0.6 -p services</code> 即可。</p><h3 id=4-配置>4 配置</h3><p>如果需要快速启动 HugeGraph 仅用于测试,那么只需要进行少数几个配置项的修改即可(见下一节)。</p><p>详细的配置介绍请参考<a href=/docs/config/config-guide>配置文档</a><a href=/docs/config/config-option>配置项介绍</a></p><h3 id=5-启动>5 启动</h3><h4 id=51-使用启动脚本启动>5.1 使用启动脚本启动</h4><p>启动分为"首次启动"和"非首次启动",这么区分是因为在第一次启动前需要初始化后端数据库,然后启动服务。</p><p>而在人为停掉服务后,或者其他原因需要再次启动服务时,因为后端数据库是持久化存在的,直接启动服务即可。</p><p>HugeGraphServer 启动时会连接后端存储并尝试检查后端存储版本号,如果未初始化后端或者后端已初始化但版本不匹配时(旧版本数据),HugeGraphServer 会启动失败,并给出错误信息。</p><p>如果需要外部访问 HugeGraphServer,请修改 <code>rest-server.properties</code><code>restserver.url</code> 配置项(默认为 <code>http://127.0.0.1:8080</code>),修改成机器名或 IP 地址。</p><p>由于各种后端所需的配置(hugegraph.properties)及启动步骤略有不同,下面逐一对各后端的配置及启动做介绍。</p><p>如果想要使用 HugeGraph 鉴权模式,在后面正式启动 Server 之前应按照 <a href=https://hugegraph.apache.org/cn/docs/config/config-authentication/>Server 鉴权配置</a> 进行配置。</p><h5 id=511-rocksdb>5.1.1 RocksDB</h5><details><summary>点击展开/折叠 RocksDB 配置及启动方法</summary><blockquote><p>RocksDB 是一个嵌入式的数据库,不需要手动安装部署,要求 GCC 版本 >= 4.3.0(GLIBCXX_3.4.10),如不满足,需要提前升级 GCC</p></blockquote><p>修改 <code>hugegraph.properties</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>rocksdb.data_path=.
</span></span><span style=display:flex><span>rocksdb.wal_path=.
</span></span></code></pre></div><p>初始化数据库(第一次启动时或在 <code>conf/graphs/</code> 下手动添加了新配置时需要进行初始化)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span></code></pre></div><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div><p>提示的 url 与 <code>rest-server.properties</code> 中配置的 <code>restserver.url</code> 一致</p></details><h5 id=512-hbase>5.1.2 HBase</h5><details><summary>点击展开/折叠 HBase 配置及启动方法</summary><blockquote><p>用户需自行安装 HBase,要求版本 2.0 以上,<a href=https://hbase.apache.org/downloads.html>下载地址</a></p></blockquote><p>修改 hugegraph.properties</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=hbase
</span></span><span style=display:flex><span>serializer=hbase
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># hbase backend config
</span></span><span style=display:flex><span>hbase.hosts=localhost
</span></span><span style=display:flex><span>hbase.port=2181
</span></span><span style=display:flex><span># Note: recommend to modify the HBase partition number by the actual/env data amount &amp; RS amount before init store
</span></span><span style=display:flex><span># it may influence the loading speed a lot
</span></span><span style=display:flex><span>#hbase.enable_partition=true
</span></span><span style=display:flex><span>#hbase.vertex_partitions=10
</span></span><span style=display:flex><span>#hbase.edge_partitions=30
</span></span></code></pre></div><p>初始化数据库(第一次启动时或在 <code>conf/graphs/</code> 下手动添加了新配置时需要进行初始化)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span></code></pre></div><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div><blockquote><p>更多其它后端配置可参考<a href=/docs/config/config-option>配置项介绍</a></p></blockquote></details><h5 id=513-mysql>5.1.3 MySQL</h5><details><summary>点击展开/折叠 MySQL 配置及启动方法</summary><blockquote><p>由于 MySQL 是在 GPL 协议下,与 Apache 协议不兼容,用户需自行安装 MySQL,<a href=https://dev.mysql.com/downloads/mysql/>下载地址</a></p></blockquote><p>下载 MySQL 的<a href=https://repo1.maven.org/maven2/mysql/mysql-connector-java/>驱动包</a>,比如 <code>mysql-connector-java-8.0.30.jar</code>,并放入 HugeGraph-Server 的 <code>lib</code> 目录下。</p><p>修改 <code>hugegraph.properties</code>,配置数据库 URL,用户名和密码,<code>store</code> 是数据库名,如果没有会被自动创建。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=mysql
</span></span><span style=display:flex><span>serializer=mysql
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>store=hugegraph
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># mysql backend config
</span></span><span style=display:flex><span>jdbc.driver=com.mysql.cj.jdbc.Driver
</span></span><span style=display:flex><span>jdbc.url=jdbc:mysql://127.0.0.1:3306
</span></span><span style=display:flex><span>jdbc.username=
</span></span><span style=display:flex><span>jdbc.password=
</span></span><span style=display:flex><span>jdbc.reconnect_max_times=3
</span></span><span style=display:flex><span>jdbc.reconnect_interval=3
</span></span><span style=display:flex><span>jdbc.ssl_mode=false
</span></span></code></pre></div><p>初始化数据库(第一次启动时或在 <code>conf/graphs/</code> 下手动添加了新配置时需要进行初始化)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span></code></pre></div><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div></details><h5 id=514-cassandra>5.1.4 Cassandra</h5><details><summary>点击展开/折叠 Cassandra 配置及启动方法</summary><blockquote><p>用户需自行安装 Cassandra,要求版本 3.0 以上,<a href=http://cassandra.apache.org/download/>下载地址</a></p></blockquote><p>修改 hugegraph.properties</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=cassandra
</span></span><span style=display:flex><span>serializer=cassandra
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># cassandra backend config
</span></span><span style=display:flex><span>cassandra.host=localhost
</span></span><span style=display:flex><span>cassandra.port=9042
</span></span><span style=display:flex><span>cassandra.username=
</span></span><span style=display:flex><span>cassandra.password=
</span></span><span style=display:flex><span>#cassandra.connect_timeout=5
</span></span><span style=display:flex><span>#cassandra.read_timeout=20
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#cassandra.keyspace.strategy=SimpleStrategy
</span></span><span style=display:flex><span>#cassandra.keyspace.replication=3
</span></span></code></pre></div><p>初始化数据库(第一次启动时或在 <code>conf/graphs/</code> 下手动添加了新配置时需要进行初始化)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span><span style=display:flex><span>Initing HugeGraph Store...
</span></span><span style=display:flex><span>2017-12-01 11:26:51 <span style=color:#0000cf;font-weight:700>1424</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.HugeGraph <span style=color:#ce5c00;font-weight:700>[]</span> - Opening backend store: <span style=color:#4e9a06>&#39;cassandra&#39;</span>
</span></span><span style=display:flex><span>2017-12-01 11:26:52 <span style=color:#0000cf;font-weight:700>2389</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:26:52 <span style=color:#0000cf;font-weight:700>2472</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:26:52 <span style=color:#0000cf;font-weight:700>2557</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:26:53 <span style=color:#0000cf;font-weight:700>2797</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_graph
</span></span><span style=display:flex><span>2017-12-01 11:26:53 <span style=color:#0000cf;font-weight:700>2945</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_schema
</span></span><span style=display:flex><span>2017-12-01 11:26:53 <span style=color:#0000cf;font-weight:700>3044</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_index
</span></span><span style=display:flex><span>2017-12-01 11:26:53 <span style=color:#0000cf;font-weight:700>3046</span> <span style=color:#ce5c00;font-weight:700>[</span>pool-3-thread-1<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.Transaction <span style=color:#ce5c00;font-weight:700>[]</span> - Clear cache on event <span style=color:#4e9a06>&#39;store.init&#39;</span>
</span></span><span style=display:flex><span>2017-12-01 11:26:59 <span style=color:#0000cf;font-weight:700>9720</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.HugeGraph <span style=color:#ce5c00;font-weight:700>[]</span> - Opening backend store: <span style=color:#4e9a06>&#39;cassandra&#39;</span>
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>9805</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph1, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>9886</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph1, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>9955</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Failed to connect keyspace: hugegraph1, try init keyspace later
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>10175</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_graph
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>10321</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_schema
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>10413</span> <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.store.cassandra.CassandraStore <span style=color:#ce5c00;font-weight:700>[]</span> - Store initialized: huge_index
</span></span><span style=display:flex><span>2017-12-01 11:27:00 <span style=color:#0000cf;font-weight:700>10413</span> <span style=color:#ce5c00;font-weight:700>[</span>pool-3-thread-1<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> org.apache.hugegraph.backend.Transaction <span style=color:#ce5c00;font-weight:700>[]</span> - Clear cache on event <span style=color:#4e9a06>&#39;store.init&#39;</span>
</span></span></code></pre></div><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div></details><h5 id=515-memory>5.1.5 Memory</h5><details><summary>点击展开/折叠 Memory 配置及启动方法</summary><p>修改 hugegraph.properties</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=memory
</span></span><span style=display:flex><span>serializer=text
</span></span></code></pre></div><blockquote><p>Memory 后端的数据是保存在内存中无法持久化的,不需要初始化后端,这也是唯一一个不需要初始化的后端。</p></blockquote><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div><p>提示的 url 与 rest-server.properties 中配置的 restserver.url 一致</p></details><h5 id=516-scylladb>5.1.6 ScyllaDB</h5><details><summary>点击展开/折叠 ScyllaDB 配置及启动方法</summary><blockquote><p>用户需自行安装 ScyllaDB,推荐版本 2.1 以上,<a href=https://docs.scylladb.com/getting-started/>下载地址</a></p></blockquote><p>修改 hugegraph.properties</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=scylladb
</span></span><span style=display:flex><span>serializer=scylladb
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># cassandra backend config
</span></span><span style=display:flex><span>cassandra.host=localhost
</span></span><span style=display:flex><span>cassandra.port=9042
</span></span><span style=display:flex><span>cassandra.username=
</span></span><span style=display:flex><span>cassandra.password=
</span></span><span style=display:flex><span>#cassandra.connect_timeout=5
</span></span><span style=display:flex><span>#cassandra.read_timeout=20
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#cassandra.keyspace.strategy=SimpleStrategy
</span></span><span style=display:flex><span>#cassandra.keyspace.replication=3
</span></span></code></pre></div><p>由于 scylladb 数据库本身就是基于 cassandra 的"优化版",如果用户未安装 scylladb,也可以直接使用 cassandra 作为后端存储,只需要把 backend 和 serializer 修改为 scylladb,host 和 post 指向 cassandra 集群的 seeds 和 port 即可,但是并不建议这样做,这样发挥不出 scylladb 本身的优势了。</p><p>初始化数据库(第一次启动时或在 <code>conf/graphs/</code> 下手动添加了新配置时需要进行初始化)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span></code></pre></div><p>启动 server</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>....OK
</span></span></code></pre></div></details><h5 id=517-启动-server-的时候创建示例图>5.1.7 启动 server 的时候创建示例图</h5><p>在脚本启动时候携带 <code>-p true</code>参数,表示 preload, 即创建示例图图</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>bin/start-hugegraph.sh -p true
</span></span><span style=display:flex><span>Starting HugeGraphServer in daemon mode...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK
</span></span></code></pre></div><p>并且使用 RESTful API 请求 <code>HugeGraphServer</code> 得到如下结果:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>curl</span> <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span> <span style=color:#ce5c00;font-weight:700>|</span> <span style=color:#000>gunzip</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;vertices&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>[{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>35</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>199</span><span style=color:#000;font-weight:700>}}]}</span>
</span></span></code></pre></div><p>代表创建示例图成功。</p><h4 id=52-使用-docker>5.2 使用 Docker</h4><p><a href=#33-%E4%BD%BF%E7%94%A8-docker-%E5%AE%B9%E5%99%A8>3.3 使用 Docker 容器</a>中,我们已经介绍了如何使用 <code>docker</code> 部署 <code>hugegraph-server</code>, 我们还可以使用其他的后端存储或者设置参数在 sever 启动的时候加载样例图</p><h5 id=521-使用-cassandra-作为后端>5.2.1 使用 Cassandra 作为后端</h5><details><summary>点击展开/折叠 Cassandra 配置及启动方法</summary><p>在使用 Docker 的时候,我们可以使用 Cassandra 作为后端存储。我们更加推荐直接使用 docker-compose 来对于 server 以及 Cassandra 进行统一管理</p><p>样例的 <code>docker-compose.yml</code> 可以在 <a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/docker/example/docker-compose-cassandra.yml>github</a> 中获取,使用 <code>docker-compose up -d</code> 启动。(如果使用 cassandra 4.0 版本作为后端存储,则需要大约两个分钟初始化,请耐心等待)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;3&#34;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cas-server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>environment</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.backend</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cassandra</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.serializer</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cassandra</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.cassandra.host</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cas-cassandra</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.cassandra.port</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>9042</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>networks</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>ca-network</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>depends_on</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>cassandra</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>healthcheck</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>test</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;CMD&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;bin/gremlin-console.sh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;--&#34;</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;-e&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;scripts/remote-connect.groovy&#34;</span><span style=color:#000;font-weight:700>]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>interval</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>10s</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>timeout</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>30s</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>retries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>3</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>cassandra</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cassandra:4</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>cas-cassandra</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>7000</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>7000</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>9042</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>9042</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>security_opt</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>seccomp:unconfined</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>networks</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>ca-network</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>healthcheck</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>test</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;CMD&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;cqlsh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;--execute&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;describe keyspaces;&#34;</span><span style=color:#000;font-weight:700>]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>interval</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>10s</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>timeout</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>30s</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>retries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>5</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>networks</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ca-network</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>volumes</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph-data</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p>在这个 yaml 中,需要在环境变量中以 <code>hugegraph.&lt;parameter_name></code>的形式进行参数传递,配置 Cassandra 相关的参数。</p><p>具体来说,在 <code>hugegraph.properties</code> 配置文件中,提供了 <code>backend=xxx</code>, <code>cassandra.host=xxx</code> 等配置项,为了配置这些配置项,在传递环境变量的过程之中,我们需要在这些配置项前加上 <code>hugegrpah.</code>,即 <code>hugegraph.backend</code><code>hugegraph.cassandra.host</code></p><p>其他配置可以参照 <a href=#4-%E9%85%8D%E7%BD%AE>4 配置</a></p></details><h5 id=522-启动-server-的时候创建示例图>5.2.2 启动 server 的时候创建示例图</h5><p>在 docker 启动的时候设置环境变量 <code>PRELOAD=true</code>, 从而实现启动脚本的时候加载数据。</p><ol><li><p>使用<code>docker run</code></p><p>使用 <code>docker run -itd --name=server -p 8080:8080 -e PRELOAD=true hugegraph/hugegraph:latest</code></p></li><li><p>使用<code>docker-compose</code></p><p>创建<code>docker-compose.yml</code>,具体文件如下,在环境变量中设置 PRELOAD=true。其中,<a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/src/assembly/static/scripts/example.groovy><code>example.groovy</code></a> 是一个预定义的脚本,用于预加载样例数据。如果有需要,可以通过挂载新的 <code>example.groovy</code> 脚本改变预加载的数据。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;3&#39;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph:latest</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>environment</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>PRELOAD=true</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>volumes</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>/path/to/yourscript:/hugegraph/scripts/example.groovy</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p>使用命令 <code>docker-compose up -d</code> 启动容器</p></li></ol><p>使用 RESTful API 请求 <code>HugeGraphServer</code> 得到如下结果:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>curl</span> <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span> <span style=color:#ce5c00;font-weight:700>|</span> <span style=color:#000>gunzip</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;vertices&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>[{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>35</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#000;font-weight:700>}},{</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>199</span><span style=color:#000;font-weight:700>}}]}</span>
</span></span></code></pre></div><p>代表创建示例图成功。</p><h3 id=6-访问-server>6 访问 Server</h3><h4 id=61-服务启动状态校验>6.1 服务启动状态校验</h4><p><code>jps</code> 查看服务进程</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>jps
</span></span><span style=display:flex><span><span style=color:#0000cf;font-weight:700>6475</span> HugeGraphServer
</span></span></code></pre></div><p><code>curl</code> 请求 RESTful API</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>echo</span> <span style=color:#4e9a06>`</span>curl -o /dev/null -s -w %<span style=color:#ce5c00;font-weight:700>{</span>http_code<span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span><span style=color:#4e9a06>`</span>
</span></span></code></pre></div><p>返回结果 200,代表 server 启动正常</p><h4 id=62-请求-server>6.2 请求 Server</h4><p>HugeGraphServer 的 RESTful API 包括多种类型的资源,典型的包括 graph、schema、gremlin、traverser 和 task</p><ul><li><code>graph</code> 包含 <code>vertices</code><code>edges</code></li><li><code>schema</code> 包含 <code>vertexlabels</code><code>propertykeys</code><code>edgelabels</code><code>indexlabels</code></li><li><code>gremlin</code> 包含各种 <code>Gremlin</code> 语句,如 <code>g.v()</code>,可以同步或者异步执行</li><li><code>traverser</code> 包含各种高级查询,包括最短路径、交叉点、N 步可达邻居等</li><li><code>task</code> 包含异步任务的查询和删除</li></ul><h5 id=621-获取-hugegraph-的顶点及相关属性>6.2.1 获取 <code>hugegraph</code> 的顶点及相关属性</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl http://localhost:8080/graphs/hugegraph/graph/vertices
</span></span></code></pre></div><p><em>说明</em></p><ol><li><p>由于图的点和边很多,对于 list 型的请求,比如获取所有顶点,获取所有边等,Server 会将数据压缩再返回,所以使用 curl 时得到一堆乱码,可以重定向至 <code>gunzip</code> 进行解压。推荐使用 Chrome 浏览器 + Restlet 插件发送 HTTP 请求进行测试。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>curl &#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34; | gunzip
</span></span></code></pre></div></li><li><p>当前 HugeGraphServer 的默认配置只能是本机访问,可以修改配置,使其能在其他机器访问。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>vim conf/rest-server.properties
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>restserver.url=http://0.0.0.0:8080
</span></span></code></pre></div></li></ol><p>响应体如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#a40000>...</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p id=swaggerui-example></p><p>详细的 API 请参考 <a href=/docs/clients/restful-api>RESTful-API</a> 文档。</p><p>另外也可以通过访问 <code>localhost:8080/swagger-ui/index.html</code> 查看 API。</p><div style=text-align:center><img src=/docs/images/images-server/swagger-ui.png alt=image></div><p>在使用 Swagger UI 调试 HugeGraph 提供的 API 时,如果 HugeGraph Server 开启了鉴权模式,可以在 Swagger 页面输入鉴权信息。</p><div style=text-align:center><img src=/docs/images/images-server/swagger-ui-where-set-auth-example.png alt=image></div><p>当前 HugeGraph 支持基于 Basic 和 Bearer 两种形式设置鉴权信息。</p><div style=text-align:center><img src=/docs/images/images-server/swagger-ui-set-auth-example.png alt=image></div><h3 id=7-停止-server>7 停止 Server</h3><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#000>$cd</span> *hugegraph-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>
</span></span><span style=display:flex><span><span style=color:#000>$bin</span>/stop-hugegraph.sh
</span></span></code></pre></div><h3 id=8-使用-intellij-idea-调试-server>8 使用 IntelliJ IDEA 调试 Server</h3><p>请参考<a href=/docs/contribution-guidelines/hugegraph-server-idea-setup>在 IDEA 中配置 Server 开发环境</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-685a02f8811d86f1ce195d7c73d9ea44>3.2 - HugeGraph-Loader Quick Start</h1><h3 id=1-hugegraph-loader-概述>1 HugeGraph-Loader 概述</h3><p>HugeGraph-Loader 是 HugeGraph 的数据导入组件,能够将多种数据源的数据转化为图的顶点和边并批量导入到图数据库中。</p><p>目前支持的数据源包括:</p><ul><li>本地磁盘文件或目录,支持 TEXT、CSV 和 JSON 格式的文件,支持压缩文件</li><li>HDFS 文件或目录,支持压缩文件</li><li>主流关系型数据库,如 MySQL、PostgreSQL、Oracle、SQL Server</li></ul><p>本地磁盘文件和 HDFS 文件支持断点续传。</p><p>后面会具体说明。</p><blockquote><p>注意:使用 HugeGraph-Loader 需要依赖 HugeGraph Server 服务,下载和启动 Server 请参考 <a href=/docs/quickstart/hugegraph-server>HugeGraph-Server Quick Start</a></p></blockquote><h3 id=2-获取-hugegraph-loader>2 获取 HugeGraph-Loader</h3><p>有两种方式可以获取 HugeGraph-Loader:</p><ul><li>使用 Docker 镜像 (便于<strong>测试</strong>)</li><li>下载已编译的压缩包</li><li>克隆源码编译安装</li></ul><h4 id=21-使用-docker-镜像-便于测试>2.1 使用 Docker 镜像 (便于<strong>测试</strong>)</h4><p>我们可以使用 <code>docker run -itd --name loader hugegraph/loader</code>部署 loader 服务。对于需要加载的数据,则可以通过挂载 <code>-v /path/to/data/file:/loader/file</code> 或者<code>docker cp</code>的方式将文件复制到 loader 容器内部。</p><p>或者使用 docker-compose 启动 loader, 启动命令为 <code>docker-compose up -d</code>, 样例的 docker-compose.yml 如下所示:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;3&#39;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hubble</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hubble</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hubble</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8088</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8088</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>loader</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/loader</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>loader</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># mount your own data here</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># volumes:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># - /path/to/data/file:/loader/file</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p>具体的数据导入流程可以参考 <a href=#45-%E4%BD%BF%E7%94%A8-docker-%E5%AF%BC%E5%85%A5>4.5 使用 docker 导入</a></p><blockquote><p>注意:</p><ol><li><p>hugegraph-loader 的 docker 镜像是一个便捷版本,用于快速启动 loader,并不是<strong>官方发布物料包方式</strong>。你可以从 <a href=https://infra.apache.org/release-distribution.html#dockerhub>ASF Release Distribution Policy</a> 中得到更多细节。</p></li><li><p>推荐使用 <code>release tag</code>(如 <code>1.2.0</code>) 以获取稳定版。使用 <code>latest</code> tag 可以使用开发中的最新功能。</p></li></ol></blockquote><h4 id=22-下载已编译的压缩包>2.2 下载已编译的压缩包</h4><p>下载最新版本的 <code>HugeGraph-Toolchain</code> Release 包,里面包含了 <code>loader + tool + hubble</code> 全套工具,如果你已经下载,可跳过重复步骤</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>/apache-hugegraph-toolchain-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>.tar.gz
</span></span><span style=display:flex><span>tar zxf *hugegraph*.tar.gz
</span></span></code></pre></div><h4 id=23-克隆源码编译安装>2.3 克隆源码编译安装</h4><p>克隆最新版本的 HugeGraph-Loader 源码包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 1. get from github</span>
</span></span><span style=display:flex><span>git clone https://github.com/apache/hugegraph-toolchain.git
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 2. get from direct url (please choose the **latest release** version)</span>
</span></span><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>/apache-hugegraph-toolchain-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>-src.tar.gz
</span></span></code></pre></div><details><summary>点击展开/折叠 手动安装 ojdbc 方法</summary><p>由于 Oracle ojdbc license 的限制,需要手动安装 ojdbc 到本地 maven 仓库。
访问 <a href=https://www.oracle.com/database/technologies/appdev/jdbc-drivers-archive.html>Oracle jdbc 下载</a> 页面。选择 Oracle Database 12c Release 2 (12.2.0.1) drivers,如下图所示。</p><p>打开链接后,选择“ojdbc8.jar”</p><p>把 ojdbc8 安装到本地 maven 仓库,进入<code>ojdbc8.jar</code>所在目录,执行以下命令。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>mvn install:install-file -Dfile=./ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
</span></span></code></pre></div></details><p>编译生成 tar 包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph-loader
</span></span><span style=display:flex><span>mvn clean package -DskipTests
</span></span></code></pre></div><h3 id=3-使用流程>3 使用流程</h3><p>使用 HugeGraph-Loader 的基本流程分为以下几步:</p><ul><li>编写图模型</li><li>准备数据文件</li><li>编写输入源映射文件</li><li>执行命令导入</li></ul><h4 id=31-编写图模型>3.1 编写图模型</h4><p>这一步是建模的过程,用户需要对自己已有的数据和想要创建的图模型有一个清晰的构想,然后编写 schema 建立图模型。</p><p>比如想创建一个拥有两类顶点及两类边的图,顶点是"人"和"软件",边是"人认识人"和"人创造软件",并且这些顶点和边都带有一些属性,比如顶点"人"有:&ldquo;姓名&rdquo;、&ldquo;年龄"等属性,
&ldquo;软件"有:&ldquo;名字&rdquo;、&ldquo;售卖价格"等属性;边"认识"有:&ldquo;日期"属性等。</p><div style=text-align:center><img src=/docs/images/demo-graph-model.png alt=image><p>示例图模型</p></div><p>在设计好了图模型之后,我们可以用<code>groovy</code>编写出<code>schema</code>的定义,并保存至文件中,这里命名为<code>schema.groovy</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 创建一些属性
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 创建 person 顶点类型,其拥有三个属性:name, age, city,主键是 name
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 创建 software 顶点类型,其拥有两个属性:name, price,主键是 name
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 创建 knows 边类型,这类边是从 person 指向 person 的
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 创建 created 边类型,这类边是从 person 指向 software 的
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><blockquote><p>关于 schema 的详细说明请参考 <a href=/docs/clients/hugegraph-client>hugegraph-client</a> 中对应部分。</p></blockquote><h4 id=32-准备数据>3.2 准备数据</h4><p>目前 HugeGraph-Loader 支持的数据源包括:</p><ul><li>本地磁盘文件或目录</li><li>HDFS 文件或目录</li><li>部分关系型数据库</li><li>Kafka topic</li></ul><h5 id=321-数据源结构>3.2.1 数据源结构</h5><h6 id=3211-本地磁盘文件或目录>3.2.1.1 本地磁盘文件或目录</h6><p>用户可以指定本地磁盘文件作为数据源,如果数据分散在多个文件中,也支持以某个目录作为数据源,但暂时不支持以多个目录作为数据源。</p><p>比如:我的数据分散在多个文件中,part-0、part-1 &mldr; part-n,要想执行导入,必须保证它们是放在一个目录下的。然后在 loader 的映射文件中,将<code>path</code>指定为该目录即可。</p><p>支持的文件格式包括:</p><ul><li>TEXT</li><li>CSV</li><li>JSON</li></ul><p>TEXT 是自定义分隔符的文本文件,第一行通常是标题,记录了每一列的名称,也允许没有标题行(在映射文件中指定)。其余的每行代表一条记录,会被转化为一个顶点/边;行的每一列对应一个字段,会被转化为顶点/边的 id、label 或属性;</p><p>示例如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>id|name|lang|price|ISBN
</span></span><span style=display:flex><span>1|lop|java|328|ISBN978-7-107-18618-5
</span></span><span style=display:flex><span>2|ripple|java|199|ISBN978-7-100-13678-5
</span></span></code></pre></div><p>CSV 是分隔符为逗号<code>,</code>的 TEXT 文件,当列值本身包含逗号时,该列值需要用双引号包起来,如:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>marko,29,Beijing
</span></span><span style=display:flex><span>&#34;li,nary&#34;,26,&#34;Wu,han&#34;
</span></span></code></pre></div><p>JSON 文件要求每一行都是一个 JSON 串,且每行的格式需保持一致。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160110&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.5</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130220&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=3212-hdfs-文件或目录>3.2.1.2 HDFS 文件或目录</h6><p>用户也可以指定 HDFS 文件或目录作为数据源,上面关于<code>本地磁盘文件或目录</code>的要求全部适用于这里。除此之外,鉴于 HDFS 上通常存储的都是压缩文件,loader 也提供了对压缩文件的支持,并且<code>本地磁盘文件或目录</code>同样支持压缩文件。</p><p>目前支持的压缩文件类型包括:GZIP、BZ2、XZ、LZMA、SNAPPY_RAW、SNAPPY_FRAMED、Z、DEFLATE、LZ4_BLOCK、LZ4_FRAMED、ORC 和 PARQUET。</p><h6 id=3213-主流关系型数据库>3.2.1.3 主流关系型数据库</h6><p>loader 还支持以部分关系型数据库作为数据源,目前支持 MySQL、PostgreSQL、Oracle 和 SQL Server。</p><p>但目前对表结构要求较为严格,如果导入过程中需要做<strong>关联查询</strong>,这样的表结构是不允许的。关联查询的意思是:在读到表的某行后,发现某列的值不能直接使用(比如外键),需要再去做一次查询才能确定该列的真实值。</p><p>举个例子:假设有三张表,person、software 和 created</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>// person 表结构
</span></span><span style=display:flex><span>id | name | age | city
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>// software 表结构
</span></span><span style=display:flex><span>id | name | lang | price
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>// created 表结构
</span></span><span style=display:flex><span>id | p_id | s_id | date
</span></span></code></pre></div><p>如果在建模(schema)时指定 person 或 software 的 id 策略是 PRIMARY_KEY,选择以 name 作为 primary keys(注意:这是 hugegraph 中 vertexlabel 的概念),在导入边数据时,由于需要拼接出源顶点和目标顶点的 id,必须拿着 p_id/s_id 去 person/software 表中查到对应的 name,这种需要做额外查询的表结构的情况,loader 暂时是不支持的。这时可以采用以下两种方式替代:</p><ol><li>仍然指定 person 和 software 的 id 策略为 PRIMARY_KEY,但是以 person 表和 software 表的 id 列作为顶点的主键属性,这样导入边时直接使用 p_id 和 s_id 和顶点的 label 拼接就能生成 id 了;</li><li>指定 person 和 software 的 id 策略为 CUSTOMIZE,然后直接以 person 表和 software 表的 id 列作为顶点 id,这样导入边时直接使用 p_id 和 s_id 即可;</li></ol><p>关键点就是要让边能直接使用 p_id 和 s_id,不要再去查一次。</p><h5 id=322-准备顶点和边数据>3.2.2 准备顶点和边数据</h5><h6 id=3221-顶点数据>3.2.2.1 顶点数据</h6><p>顶点数据文件由一行一行的数据组成,一般每一行作为一个顶点,每一列会作为顶点属性。下面以 CSV 格式作为示例进行说明。</p><ul><li>person 顶点数据(数据本身不包含 header)</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>Tom,48,Beijing
</span></span><span style=display:flex><span>Jerry,36,Shanghai
</span></span></code></pre></div><ul><li>software 顶点数据(数据本身包含 header)</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>name,price
</span></span><span style=display:flex><span>Photoshop,999
</span></span><span style=display:flex><span>Office,388
</span></span></code></pre></div><h6 id=3222-边数据>3.2.2.2 边数据</h6><p>边数据文件由一行一行的数据组成,一般每一行作为一条边,其中有部分列会作为源顶点和目标顶点的 id,其他列作为边属性。下面以 JSON 格式作为示例进行说明。</p><ul><li>knows 边数据</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Tom&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Jerry&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2008-12-12&#34;</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><ul><li>created 边数据</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Tom&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Photoshop&#34;</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Tom&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Office&#34;</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Jerry&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Office&#34;</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=33-编写数据源映射文件>3.3 编写数据源映射文件</h4><h5 id=331-映射文件概述>3.3.1 映射文件概述</h5><p>输入源的映射文件用于描述如何将输入源数据与图的顶点类型/边类型建立映射关系,以<code>JSON</code>格式组织,由多个映射块组成,其中每一个映射块都负责将一个输入源映射为顶点和边。</p><p>具体而言,每个映射块包含<strong>一个输入源</strong>和多个<strong>顶点映射</strong><strong>边映射</strong>块,输入源块对应上面介绍的<code>本地磁盘文件或目录</code><code>HDFS 文件或目录</code><code>关系型数据库</code>,负责描述数据源的基本信息,比如数据在哪,是什么格式的,分隔符是什么等。顶点映射/边映射与该输入源绑定,可以选择输入源的哪些列,哪些列作为 id、哪些列作为属性,以及每一列映射成什么属性,列的值映射成属性的什么值等等。</p><p>以最通俗的话讲,每一个映射块描述了:要导入的文件在哪,文件的每一行要作为哪一类顶点/边,文件的哪些列是需要导入的,以及这些列对应顶点/边的什么属性等。</p><blockquote><p>注意:0.11.0 版本以前的映射文件与 0.11.0 以后的格式变化较大,为表述方便,下面称 0.11.0 以前的映射文件(格式)为 1.0 版本,0.11.0 以后的为 2.0 版本。并且若无特殊说明,“映射文件”表示的是 2.0 版本的。</p></blockquote><details><summary>点击展开/折叠 2.0 版本的映射文件的框架</summary><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;version&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2.0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;structs&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></details><br><p>这里直接给出两个版本的映射文件(描述了上面图模型和数据文件)</p><details><summary>点击展开/折叠 2.0 版本的映射文件</summary><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;version&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2.0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;structs&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;FILE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex_person.csv&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;file_filter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;extensions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;*&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CSV&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;,&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyy-MM-dd HH:mm:ss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;time_zone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GMT+8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skipped_line&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;regex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;(^#|^//).*|&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;compression&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;list_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start_symbol&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;[&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;elem_delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;|&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end_symbol&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;]&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;selected&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;null_values&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;FILE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex_software.csv&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;file_filter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;extensions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;*&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CSV&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;,&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyy-MM-dd HH:mm:ss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;time_zone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GMT+8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skipped_line&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;regex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;(^#|^//).*|&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;compression&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;list_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start_symbol&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;elem_delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;,&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end_symbol&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;selected&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;null_values&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;FILE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge_knows.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;file_filter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;extensions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;*&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyy-MM-dd HH:mm:ss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;time_zone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GMT+8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skipped_line&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;regex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;(^#|^//).*|&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;compression&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;list_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;source_name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold_source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;target_name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold_target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;selected&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;null_values&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;FILE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge_created.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;file_filter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;extensions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;*&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyy-MM-dd HH:mm:ss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;time_zone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GMT+8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skipped_line&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;regex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;(^#|^//).*|&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;compression&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;list_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;source_name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold_source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;target_name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unfold_target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;selected&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;null_values&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></details><br><details><summary>点击展开/折叠 1.0 版本的映射文件</summary><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex_person.csv&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CSV&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex_software.csv&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CSV&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge_knows.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge_created.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></details><br><p>映射文件 1.0 版本是以顶点和边为中心,设置输入源;而 2.0 版本是以输入源为中心,设置顶点和边映射。有些输入源(比如一个文件)既能生成顶点,也能生成边,如果用 1.0 版的格式写,就需要在 vertex 和 edge 映射块中各写一次 input 块,这两次的 input 块是完全一样的;而 2.0 版本只需要写一次 input。所以 2.0 版相比于 1.0 版,能省掉一些 input 的重复书写。</p><p>在 hugegraph-loader-{version} 的 bin 目录下,有一个脚本工具 <code>mapping-convert.sh</code> 能直接将 1.0 版本的映射文件转换为 2.0 版本的,使用方式如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/mapping-convert.sh struct.json
</span></span></code></pre></div><p>会在 struct.json 的同级目录下生成一个 struct-v2.json。</p><h5 id=332-输入源>3.3.2 输入源</h5><p>输入源目前分为四类:FILE、HDFS、JDBC、KAFKA,由<code>type</code>节点区分,我们称为本地文件输入源、HDFS 输入源、JDBC 输入源和 KAFKA 输入源,下面分别介绍。</p><h6 id=3321-本地文件输入源>3.3.2.1 本地文件输入源</h6><ul><li>id: 输入源的 id,该字段用于支持一些内部功能,非必填(未填时会自动生成),强烈建议写上,对于调试大有裨益;</li><li>skip: 是否跳过该输入源,由于 JSON 文件无法添加注释,如果某次导入时不想导入某个输入源,但又不想删除该输入源的配置,则可以设置为 true 将其跳过,默认为 false,非必填;</li><li>input: 输入源映射块,复合结构<ul><li>type: 输入源类型,必须填 file 或 FILE;</li><li>path: 本地文件或目录的路径,绝对路径或相对于映射文件的相对路径,建议使用绝对路径,必填;</li><li>file_filter: 从<code>path</code>中筛选复合条件的文件,复合结构,目前只支持配置扩展名,用子节点<code>extensions</code>表示,默认为&rdquo;*",表示保留所有文件;</li><li>format: 本地文件的格式,可选值为 CSV、TEXT 及 JSON,必须大写,必填;</li><li>header: 文件各列的列名,如不指定则会以数据文件第一行作为 header;当文件本身有标题且又指定了 header,文件的第一行会被当作普通的数据行;JSON 文件不需要指定 header,选填;</li><li>delimiter: 文件行的列分隔符,默认以逗号<code>","</code>作为分隔符,<code>JSON</code>文件不需要指定,选填;</li><li>charset: 文件的编码字符集,默认<code>UTF-8</code>,选填;</li><li>date_format: 自定义的日期格式,默认值为 yyyy-MM-dd HH:mm:ss,选填;如果日期是以时间戳的形式呈现的,此项须写为<code>timestamp</code>(固定写法);</li><li>time_zone: 设置日期数据是处于哪个时区的,默认值为<code>GMT+8</code>,选填;</li><li>skipped_line: 想跳过的行,复合结构,目前只能配置要跳过的行的正则表达式,用子节点<code>regex</code>描述,默认不跳过任何行,选填;</li><li>compression: 文件的压缩格式,可选值为 NONE、GZIP、BZ2、XZ、LZMA、SNAPPY_RAW、SNAPPY_FRAMED、Z、DEFLATE、LZ4_BLOCK、LZ4_FRAMED、ORC 和 PARQUET,默认为 NONE,表示非压缩文件,选填;</li><li>list_format: 当文件 (非 JSON ) 的某列是集合结构时(对应图中的 PropertyKey 的 Cardinality 为 Set 或 List),可以用此项设置该列的起始符、分隔符、结束符,复合结构:<ul><li>start_symbol: 集合结构列的起始符 (默认值是 <code>[</code>, JSON 格式目前不支持指定)</li><li>elem_delimiter: 集合结构列的分隔符 (默认值是 <code>|</code>, JSON 格式目前只支持原生<code>,</code>分隔)</li><li>end_symbol: 集合结构列的结束符 (默认值是 <code>]</code>, JSON 格式目前不支持指定)</li></ul></li></ul></li></ul><h6 id=3322-hdfs-输入源>3.3.2.2 HDFS 输入源</h6><p>上述<code>本地文件输入源</code>的节点及含义这里基本都适用,下面仅列出 HDFS 输入源不一样的和特有的节点。</p><ul><li>type: 输入源类型,必须填 hdfs 或 HDFS,必填;</li><li>path: HDFS 文件或目录的路径,必须是 HDFS 的绝对路径,必填;</li><li>core_site_path: HDFS 集群的 core-site.xml 文件路径,重点要指明 NameNode 的地址(<code>fs.default.name</code>),以及文件系统的实现(<code>fs.hdfs.impl</code>);</li></ul><h6 id=3323-jdbc-输入源>3.3.2.3 JDBC 输入源</h6><p>前面说到过支持多种关系型数据库,但由于它们的映射结构非常相似,故统称为 JDBC 输入源,然后用<code>vendor</code>节点区分不同的数据库。</p><ul><li>type: 输入源类型,必须填 jdbc 或 JDBC,必填;</li><li>vendor: 数据库类型,可选项为 [MySQL、PostgreSQL、Oracle、SQLServer],不区分大小写,必填;</li><li>driver: jdbc 使用的 driver 类型,必填;</li><li>url: jdbc 要连接的数据库的 url,必填;</li><li>database: 要连接的数据库名,必填;</li><li>schema: 要连接的 schema 名,不同的数据库要求不一样,下面详细说明;</li><li>table: 要连接的表名,<code>custom_sql</code><code>table</code> 参数必须填其中一个;</li><li>custom_sql: 自定义 SQL 语句,<code>custom_sql</code><code>table</code> 参数必须填其中一个;</li><li>username: 连接数据库的用户名,必填;</li><li>password: 连接数据库的密码,必填;</li><li>batch_size: 按页获取表数据时的一页的大小,默认为 500,选填;</li></ul><p><strong>MYSQL</strong></p><table><thead><tr><th>节点</th><th>固定值或常见值</th></tr></thead><tbody><tr><td>vendor</td><td>MYSQL</td></tr><tr><td>driver</td><td>com.mysql.cj.jdbc.Driver</td></tr><tr><td>url</td><td>jdbc:mysql://127.0.0.1:3306</td></tr></tbody></table><p>schema: 可空,若填写必须与 database 的值一样</p><p><strong>POSTGRESQL</strong></p><table><thead><tr><th>节点</th><th>固定值或常见值</th></tr></thead><tbody><tr><td>vendor</td><td>POSTGRESQL</td></tr><tr><td>driver</td><td>org.postgresql.Driver</td></tr><tr><td>url</td><td>jdbc:postgresql://127.0.0.1:5432</td></tr></tbody></table><p>schema: 可空,默认值为“public”</p><p><strong>ORACLE</strong></p><table><thead><tr><th>节点</th><th>固定值或常见值</th></tr></thead><tbody><tr><td>vendor</td><td>ORACLE</td></tr><tr><td>driver</td><td>oracle.jdbc.driver.OracleDriver</td></tr><tr><td>url</td><td>jdbc:oracle:thin:@127.0.0.1:1521</td></tr></tbody></table><p>schema: 可空,默认值与用户名相同</p><p><strong>SQLSERVER</strong></p><table><thead><tr><th>节点</th><th>固定值或常见值</th></tr></thead><tbody><tr><td>vendor</td><td>SQLSERVER</td></tr><tr><td>driver</td><td>com.microsoft.sqlserver.jdbc.SQLServerDriver</td></tr><tr><td>url</td><td>jdbc:sqlserver://127.0.0.1:1433</td></tr></tbody></table><p>schema: 必填</p><h6 id=3324-kafka-输入源>3.3.2.4 Kafka 输入源</h6><ul><li>type:输入源类型,必须填 <code>kafka</code><code>KAFKA</code>,必填;</li><li>bootstrap_server:设置 kafka bootstrap server 列表;</li><li>topic:订阅的 topic;</li><li>group:Kafka 消费者组;</li><li>from_beginning:设置是否从头开始读取;</li><li>format:本地文件的格式,可选值为 CSV、TEXT 及 JSON,必须大写,必填;</li><li>header:文件各列的列名,如不指定则会以数据文件第一行作为 header;当文件本身有标题且又指定了 header,文件的第一行会被当作普通的数据行;JSON 文件不需要指定 header,选填;</li><li>delimiter:文件行的列分隔符,默认以逗号&rdquo;,&ldquo;作为分隔符,JSON 文件不需要指定,选填;</li><li>charset:文件的编码字符集,默认 UTF-8,选填;</li><li>date_format:自定义的日期格式,默认值为 yyyy-MM-dd HH:mm:ss,选填;如果日期是以时间戳的形式呈现的,此项须写为 timestamp(固定写法);</li><li>extra_date_formats:自定义的其他日期格式列表,默认为空,选填;列表中每一项都是一个 date_format 指定日期格式的备用日期格式;</li><li>time_zone:置日期数据是处于哪个时区的,默认值为 GMT+8,选填;</li><li>skipped_line:想跳过的行,复合结构,目前只能配置要跳过的行的正则表达式,用子节点 regex 描述,默认不跳过任何行,选填;</li><li>early_stop:某次从 Kafka broker 拉取的记录为空,停止任务,默认为 false,仅用于调试,选填;</li></ul><h5 id=333-顶点和边映射>3.3.3 顶点和边映射</h5><p>顶点和边映射的节点(JSON 文件中的一个 key)有很多相同的部分,下面先介绍相同部分,再分别介绍<code>顶点映射</code><code>边映射</code>的特有节点。</p><p><strong>相同部分的节点</strong></p><ul><li>label: 待导入的顶点/边数据所属的<code>label</code>,必填;</li><li>field_mapping: 将输入源列的列名映射为顶点/边的属性名,选填;</li><li>value_mapping: 将输入源的数据值映射为顶点/边的属性值,选填;</li><li>selected: 选择某些列插入,其他未选中的不插入,不能与<code>ignored</code>同时存在,选填;</li><li>ignored: 忽略某些列,使其不参与插入,不能与<code>selected</code>同时存在,选填;</li><li>null_values: 可以指定一些字符串代表空值,比如"NULL&rdquo;,如果该列对应的顶点/边属性又是一个可空属性,那在构造顶点/边时不会设置该属性的值,选填;</li><li>update_strategies: 如果数据需要按特定方式批量<strong>更新</strong>时可以对每个属性指定具体的更新策略 (具体见下),选填;</li><li>unfold: 是否将列展开,展开的每一列都会与其他列一起组成一行,相当于是展开成了多行;比如文件的某一列(id 列)的值是<code>[1,2,3]</code>,其他列的值是<code>18,Beijing</code>,当设置了 unfold 之后,这一行就会变成 3 行,分别是:<code>1,18,Beijing</code><code>2,18,Beijing</code><code>3,18,Beijing</code>。需要注意的是此项只会展开被选作为 id 的列。默认 false,选填;</li></ul><p><strong>更新策略</strong>支持 8 种 : (需要全大写)</p><ol><li>数值累加 : <code>SUM</code></li><li>两个数字/日期取更大的: <code>BIGGER</code></li><li>两个数字/日期取更小: <code>SMALLER</code></li><li><strong>Set</strong>属性取并集:<code>UNION</code></li><li><strong>Set</strong>属性取交集:<code>INTERSECTION</code></li><li><strong>List</strong>属性追加元素:<code>APPEND</code></li><li><strong>List/Set</strong>属性删除元素:<code>ELIMINATE</code></li><li>覆盖已有属性:<code>OVERRIDE</code></li></ol><p><strong>注意:</strong> 如果新导入的属性值为空,会采用已有的旧数据而不会采用空值,效果可以参考如下示例</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// JSON 文件中以如下方式指定更新策略
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SMALLER&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;set&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UNION&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex_person.txt&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;set&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 1.写入一行带 OVERRIDE 更新策略的数据 (这里 null 代表空)
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#a40000>&#39;a</span> <span style=color:#a40000>b</span> <span style=color:#204a87;font-weight:700>null</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#a40000>&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 2.再写一行
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#a40000>&#39;</span><span style=color:#204a87;font-weight:700>null</span> <span style=color:#204a87;font-weight:700>null</span> <span style=color:#a40000>c</span> <span style=color:#a40000>d&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 3.最后可以得到
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#a40000>&#39;a</span> <span style=color:#a40000>b</span> <span style=color:#a40000>c</span> <span style=color:#a40000>d&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 如果没有更新策略,则会得到
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#a40000>&#39;</span><span style=color:#204a87;font-weight:700>null</span> <span style=color:#204a87;font-weight:700>null</span> <span style=color:#a40000>c</span> <span style=color:#a40000>d&#39;</span>
</span></span></code></pre></div><blockquote><p><strong>注意</strong> : 采用了批量更新的策略后, 磁盘读请求数会大幅上升, 导入速度相比纯写覆盖会慢数倍 (此时HDD磁盘<a href=https://en.wikipedia.org/wiki/IOPS>IOPS</a>会成为瓶颈, 建议采用SSD以保证速度)</p></blockquote><p><strong>顶点映射的特有节点</strong></p><ul><li>id: 指定某一列作为顶点的 id 列,当顶点 id 策略为<code>CUSTOMIZE</code>时,必填;当 id 策略为<code>PRIMARY_KEY</code>时,必须为空;</li></ul><p><strong>边映射的特有节点</strong></p><ul><li>source: 选择输入源某几列作为<strong>源顶点</strong>的 id 列,当源顶点的 id 策略为 <code>CUSTOMIZE</code>时,必须指定某一列作为顶点的 id 列;当源顶点的 id 策略为 <code>PRIMARY_KEY</code>时,必须指定一列或多列用于拼接生成顶点的 id,也就是说,不管是哪种 id 策略,此项必填;</li><li>target: 指定某几列作为<strong>目标顶点</strong>的 id 列,与 source 类似,不再赘述;</li><li>unfold_source: 是否展开文件的 source 列,效果与顶点映射中的类似,不再赘述;</li><li>unfold_target: 是否展开文件的 target 列,效果与顶点映射中的类似,不再赘述;</li></ul><h4 id=34-执行命令导入>3.4 执行命令导入</h4><p>准备好图模型、数据文件以及输入源映射关系文件后,接下来就可以将数据文件导入到图数据库中。</p><p>导入过程由用户提交的命令控制,用户可以通过不同的参数控制执行的具体流程。</p><h5 id=341-参数说明>3.4.1 参数说明</h5><table><thead><tr><th>参数</th><th>默认值</th><th>是否必传</th><th>描述信息</th></tr></thead><tbody><tr><td><code>-f</code><code>--file</code></td><td></td><td>Y</td><td>配置脚本的路径</td></tr><tr><td><code>-g</code><code>--graph</code></td><td></td><td>Y</td><td>图数据库空间</td></tr><tr><td><code>-s</code><code>--schema</code></td><td></td><td>Y</td><td>schema 文件路径</td></tr><tr><td><code>-h</code><code>--host</code></td><td>localhost</td><td></td><td>HugeGraphServer 的地址</td></tr><tr><td><code>-p</code><code>--port</code></td><td>8080</td><td></td><td>HugeGraphServer 的端口号</td></tr><tr><td><code>--username</code></td><td>null</td><td></td><td>当 HugeGraphServer 开启了权限认证时,当前图的 username</td></tr><tr><td><code>--token</code></td><td>null</td><td></td><td>当 HugeGraphServer 开启了权限认证时,当前图的 token</td></tr><tr><td><code>--protocol</code></td><td>http</td><td></td><td>向服务端发请求的协议,可选 http 或 https</td></tr><tr><td><code>--trust-store-file</code></td><td></td><td></td><td>请求协议为 https 时,客户端的证书文件路径</td></tr><tr><td><code>--trust-store-password</code></td><td></td><td></td><td>请求协议为 https 时,客户端证书密码</td></tr><tr><td><code>--clear-all-data</code></td><td>false</td><td></td><td>导入数据前是否清除服务端的原有数据</td></tr><tr><td><code>--clear-timeout</code></td><td>240</td><td></td><td>导入数据前清除服务端的原有数据的超时时间</td></tr><tr><td><code>--incremental-mode</code></td><td>false</td><td></td><td>是否使用断点续导模式,仅输入源为 FILE 和 HDFS 支持该模式,启用该模式能从上一次导入停止的地方开始导</td></tr><tr><td><code>--failure-mode</code></td><td>false</td><td></td><td>失败模式为 true 时,会导入之前失败了的数据,一般来说失败数据文件需要在人工更正编辑好后,再次进行导入</td></tr><tr><td><code>--batch-insert-threads</code></td><td>CPUs</td><td></td><td>批量插入线程池大小 (CPUs 是当前 OS 可用可用<strong>逻辑核</strong>个数)</td></tr><tr><td><code>--single-insert-threads</code></td><td>8</td><td></td><td>单条插入线程池的大小</td></tr><tr><td><code>--max-conn</code></td><td>4 * CPUs</td><td></td><td>HugeClient 与 HugeGraphServer 的最大 HTTP 连接数,<strong>调整线程</strong>的时候建议同时调整此项</td></tr><tr><td><code>--max-conn-per-route</code></td><td>2 * CPUs</td><td></td><td>HugeClient 与 HugeGraphServer 每个路由的最大 HTTP 连接数,<strong>调整线程</strong>的时候建议同时调整此项</td></tr><tr><td><code>--batch-size</code></td><td>500</td><td></td><td>导入数据时每个批次包含的数据条数</td></tr><tr><td><code>--max-parse-errors</code></td><td>1</td><td></td><td>最多允许多少行数据解析错误,达到该值则程序退出</td></tr><tr><td><code>--max-insert-errors</code></td><td>500</td><td></td><td>最多允许多少行数据插入错误,达到该值则程序退出</td></tr><tr><td><code>--timeout</code></td><td>60</td><td></td><td>插入结果返回的超时时间(秒)</td></tr><tr><td><code>--shutdown-timeout</code></td><td>10</td><td></td><td>多线程停止的等待时间(秒)</td></tr><tr><td><code>--retry-times</code></td><td>0</td><td></td><td>发生特定异常时的重试次数</td></tr><tr><td><code>--retry-interval</code></td><td>10</td><td></td><td>重试之前的间隔时间(秒)</td></tr><tr><td><code>--check-vertex</code></td><td>false</td><td></td><td>插入边时是否检查边所连接的顶点是否存在</td></tr><tr><td><code>--print-progress</code></td><td>true</td><td></td><td>是否在控制台实时打印导入条数</td></tr><tr><td><code>--dry-run</code></td><td>false</td><td></td><td>打开该模式,只解析不导入,通常用于测试</td></tr><tr><td><code>--help</code></td><td>false</td><td></td><td>打印帮助信息</td></tr></tbody></table><h5 id=342-断点续导模式>3.4.2 断点续导模式</h5><p>通常情况下,Loader 任务都需要较长时间执行,如果因为某些原因导致导入中断进程退出,而下次希望能从中断的点继续导,这就是使用断点续导的场景。</p><p>用户设置命令行参数 &ndash;incremental-mode 为 true 即打开了断点续导模式。断点续导的关键在于进度文件,导入进程退出的时候,会把退出时刻的导入进度
记录到进度文件中,进度文件位于 <code>${struct}</code> 目录下,文件名形如 <code>load-progress ${date}</code> ,${struct} 为映射文件的前缀,${date} 为导入开始
的时刻。比如:在 <code>2019-10-10 12:30:30</code> 开始的一次导入任务,使用的映射文件为 <code>struct-example.json</code>,则进度文件的路径为与 struct-example.json
同级的 <code>struct-example/load-progress 2019-10-10 12:30:30</code></p><blockquote><p>注意:进度文件的生成与 &ndash;incremental-mode 是否打开无关,每次导入结束都会生成一个进度文件。</p></blockquote><p>如果数据文件格式都是合法的,是用户自己停止(CTRL + C 或 kill,kill -9 不支持)的导入任务,也就是说没有错误记录的情况下,下一次导入只需要设置
为断点续导即可。</p><p>但如果是因为太多数据不合法或者网络异常,达到了 &ndash;max-parse-errors 或 &ndash;max-insert-errors 的限制,Loader 会把这些插入失败的原始行记录到
失败文件中,用户对失败文件中的数据行修改后,设置 &ndash;reload-failure 为 true 即可把这些"失败文件"也当作输入源进行导入(不影响正常的文件的导入),
当然如果修改后的数据行仍然有问题,则会被再次记录到失败文件中(不用担心会有重复行)。</p><p>每个顶点映射或边映射有数据插入失败时都会产生自己的失败文件,失败文件又分为解析失败文件(后缀 .parse-error)和插入失败文件(后缀 .insert-error),
它们被保存在 <code>${struct}/current</code> 目录下。比如映射文件中有一个顶点映射 person 和边映射 knows,它们各有一些错误行,当 Loader 退出后,在
<code>${struct}/current</code> 目录下会看到如下文件:</p><ul><li>person-b4cd32ab.parse-error: 顶点映射 person 解析错误的数据</li><li>person-b4cd32ab.insert-error: 顶点映射 person 插入错误的数据</li><li>knows-eb6b2bac.parse-error: 边映射 knows 解析错误的数据</li><li>knows-eb6b2bac.insert-error: 边映射 knows 插入错误的数据</li></ul><blockquote><p>.parse-error 和 .insert-error 并不总是一起存在的,只有存在解析出错的行才会有 .parse-error 文件,只有存在插入出错的行才会有 .insert-error 文件。</p></blockquote><h5 id=343-logs-目录文件说明>3.4.3 logs 目录文件说明</h5><p>程序执行过程中各日志及错误数据会写入 hugegraph-loader.log 文件中。</p><h5 id=344-执行命令>3.4.4 执行命令</h5><p>运行 bin/hugegraph-loader 并传入参数</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph-loader -g <span style=color:#ce5c00;font-weight:700>{</span>GRAPH_NAME<span style=color:#ce5c00;font-weight:700>}</span> -f <span style=color:#4e9a06>${</span><span style=color:#000>INPUT_DESC_FILE</span><span style=color:#4e9a06>}</span> -s <span style=color:#4e9a06>${</span><span style=color:#000>SCHEMA_FILE</span><span style=color:#4e9a06>}</span> -h <span style=color:#ce5c00;font-weight:700>{</span>HOST<span style=color:#ce5c00;font-weight:700>}</span> -p <span style=color:#ce5c00;font-weight:700>{</span>PORT<span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=4-完整示例>4 完整示例</h3><p>下面给出的是 hugegraph-loader 包中 example 目录下的例子。(<a href=https://github.com/apache/incubator-hugegraph-toolchain/tree/master/hugegraph-loader/assembly/static/example/file>GitHub 地址</a>)</p><h4 id=41-准备数据>4.1 准备数据</h4><p>顶点文件:<code>example/file/vertex_person.csv</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>marko,29,Beijing
</span></span><span style=display:flex><span>vadas,27,Hongkong
</span></span><span style=display:flex><span>josh,32,Beijing
</span></span><span style=display:flex><span>peter,35,Shanghai
</span></span><span style=display:flex><span>&#34;li,nary&#34;,26,&#34;Wu,han&#34;
</span></span><span style=display:flex><span>tom,null,NULL
</span></span></code></pre></div><p>顶点文件:<code>example/file/vertex_software.txt</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>id|name|lang|price|ISBN
</span></span><span style=display:flex><span>1|lop|java|328|ISBN978-7-107-18618-5
</span></span><span style=display:flex><span>2|ripple|java|199|ISBN978-7-100-13678-5
</span></span></code></pre></div><p>边文件:<code>example/file/edge_knows.json</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160110&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.5</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130220&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>边文件:<code>example/file/edge_created.json</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;aname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;bname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;aname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;bname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20091111&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;aname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;bname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>{</span><span style=color:#204a87;font-weight:700>&#34;aname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;bname&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20170324&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.2</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=42-编写-schema>4.2 编写 schema</h4><details><summary>点击展开/折叠 schema 文件:example/file/schema.groovy</summary><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knowsByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div></details><h4 id=43-编写输入源映射文件examplefilestructjson>4.3 编写输入源映射文件<code>example/file/struct.json</code></h4><details><summary>点击展开/折叠 源映射文件 example/file/struct.json</summary><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;example/file/vertex_person.csv&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CSV&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UTF-8&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skipped_line&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;regex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;(^#|^//).*&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;null_values&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;NULL&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;null&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;example/file/vertex_software.txt&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;|&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;charset&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GBK&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;ISBN&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;example/file/edge_knows.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyyMMdd&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;target_id&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;example/file/edge_created.json&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;JSON&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date_format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;yyyy-MM-dd&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;field_mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></details><h4 id=44-执行命令导入>4.4 执行命令导入</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy
</span></span></code></pre></div><p>导入结束后,会出现类似如下统计信息:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>vertices/edges has been loaded this <span style=color:#204a87>time</span> : 8/6
</span></span><span style=display:flex><span>--------------------------------------------------
</span></span><span style=display:flex><span>count metrics
</span></span><span style=display:flex><span> input <span style=color:#204a87>read</span> success : <span style=color:#0000cf;font-weight:700>14</span>
</span></span><span style=display:flex><span> input <span style=color:#204a87>read</span> failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> vertex parse success : <span style=color:#0000cf;font-weight:700>8</span>
</span></span><span style=display:flex><span> vertex parse failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> vertex insert success : <span style=color:#0000cf;font-weight:700>8</span>
</span></span><span style=display:flex><span> vertex insert failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> edge parse success : <span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span> edge parse failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> edge insert success : <span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span> edge insert failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span></code></pre></div><h4 id=45-使用-docker-导入>4.5 使用 docker 导入</h4><h5 id=451-使用-docker-exec-直接导入数据>4.5.1 使用 docker exec 直接导入数据</h5><h6 id=4511-数据准备>4.5.1.1 数据准备</h6><p>如果仅仅尝试使用 loader, 我们可以使用内置的 example 数据集进行导入,无需自己额外准备数据</p><p>如果使用自定义的数据,则在使用 loader 导入数据之前,我们需要将数据复制到容器内部。</p><p>首先我们可以根据 <a href=#41-%E5%87%86%E5%A4%87%E6%95%B0%E6%8D%AE>4.1-4.3</a> 的步骤准备数据,将准备好的数据通过 <code>docker cp</code> 复制到 loader 容器内部。</p><p>假设我们已经按照上述的步骤准备好了对应的数据集,存放在 <code>hugegraph-dataset</code> 文件夹下,文件结构如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>tree -f hugegraph-dataset/
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>hugegraph-dataset
</span></span><span style=display:flex><span>├── hugegraph-dataset/edge_created.json
</span></span><span style=display:flex><span>├── hugegraph-dataset/edge_knows.json
</span></span><span style=display:flex><span>├── hugegraph-dataset/schema.groovy
</span></span><span style=display:flex><span>├── hugegraph-dataset/struct.json
</span></span><span style=display:flex><span>├── hugegraph-dataset/vertex_person.csv
</span></span><span style=display:flex><span>└── hugegraph-dataset/vertex_software.txt
</span></span></code></pre></div><p>将文件复制到容器内部</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker cp hugegraph-dataset loader:/loader/dataset
</span></span><span style=display:flex><span>docker <span style=color:#204a87>exec</span> -it loader ls /loader/dataset
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>edge_created.json edge_knows.json schema.groovy struct.json vertex_person.csv vertex_software.txt
</span></span></code></pre></div><h6 id=4512-数据导入>4.5.1.2 数据导入</h6><p>以内置的 example 数据集为例,我们可以使用以下的命令对数据进行导入。</p><p>如果需要导入自己准备的数据集,则只需要修改 <code>-f</code> 配置脚本的路径 以及 <code>-s</code> schema 文件路径即可。</p><p>其他的参数可以参照 <a href=#341-%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E>3.4.1 参数说明</a></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker <span style=color:#204a87>exec</span> -it loader bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h server -p <span style=color:#0000cf;font-weight:700>8080</span>
</span></span></code></pre></div><p>如果导入用户自定义的数据集,按照刚才的例子,则使用:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker <span style=color:#204a87>exec</span> -it loader bin/hugegraph-loader.sh -g hugegraph -f /loader/dataset/struct.json -s /loader/dataset/schema.groovy -h server -p <span style=color:#0000cf;font-weight:700>8080</span>
</span></span></code></pre></div><blockquote><p>如果 <code>loader</code><code>server</code>位于同一 docker 网络,则可以指定 <code>-h {server_container_name}</code>, 否则需要指定 <code>server</code>的宿主机的 ip (在我们的例子中, <code>server_container_name</code><code>server</code>).</p></blockquote><p>然后我们可以观察到结果:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>HugeGraphLoader worked in NORMAL MODE
</span></span><span style=display:flex><span>vertices/edges loaded this <span style=color:#204a87>time</span> : 8/6
</span></span><span style=display:flex><span>--------------------------------------------------
</span></span><span style=display:flex><span>count metrics
</span></span><span style=display:flex><span> input <span style=color:#204a87>read</span> success : <span style=color:#0000cf;font-weight:700>14</span>
</span></span><span style=display:flex><span> input <span style=color:#204a87>read</span> failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> vertex parse success : <span style=color:#0000cf;font-weight:700>8</span>
</span></span><span style=display:flex><span> vertex parse failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> vertex insert success : <span style=color:#0000cf;font-weight:700>8</span>
</span></span><span style=display:flex><span> vertex insert failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> edge parse success : <span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span> edge parse failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> edge insert success : <span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span> edge insert failure : <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span>--------------------------------------------------
</span></span><span style=display:flex><span>meter metrics
</span></span><span style=display:flex><span> total <span style=color:#204a87>time</span> : 0.199s
</span></span><span style=display:flex><span> <span style=color:#204a87>read</span> <span style=color:#204a87>time</span> : 0.046s
</span></span><span style=display:flex><span> load <span style=color:#204a87>time</span> : 0.153s
</span></span><span style=display:flex><span> vertex load <span style=color:#204a87>time</span> : 0.077s
</span></span><span style=display:flex><span> vertex load rate<span style=color:#ce5c00;font-weight:700>(</span>vertices/s<span style=color:#ce5c00;font-weight:700>)</span> : <span style=color:#0000cf;font-weight:700>103</span>
</span></span><span style=display:flex><span> edge load <span style=color:#204a87>time</span> : 0.112s
</span></span><span style=display:flex><span> edge load rate<span style=color:#ce5c00;font-weight:700>(</span>edges/s<span style=color:#ce5c00;font-weight:700>)</span> : <span style=color:#0000cf;font-weight:700>53</span>
</span></span></code></pre></div><p>也可以使用 <code>curl</code> 或者 <code>hubble</code>观察导入结果,此处以 <code>curl</code> 为例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>&gt; curl <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span> <span style=color:#000;font-weight:700>|</span> gunzip
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;vertices&#34;</span>:<span style=color:#ce5c00;font-weight:700>[{</span><span style=color:#4e9a06>&#34;id&#34;</span>:1,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;software&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;lop&#34;</span>,<span style=color:#4e9a06>&#34;lang&#34;</span>:<span style=color:#4e9a06>&#34;java&#34;</span>,<span style=color:#4e9a06>&#34;price&#34;</span>:328.0<span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:2,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;software&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;ripple&#34;</span>,<span style=color:#4e9a06>&#34;lang&#34;</span>:<span style=color:#4e9a06>&#34;java&#34;</span>,<span style=color:#4e9a06>&#34;price&#34;</span>:199.0<span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:tom&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;tom&#34;</span><span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:josh&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;josh&#34;</span>,<span style=color:#4e9a06>&#34;age&#34;</span>:32,<span style=color:#4e9a06>&#34;city&#34;</span>:<span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:marko&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;marko&#34;</span>,<span style=color:#4e9a06>&#34;age&#34;</span>:29,<span style=color:#4e9a06>&#34;city&#34;</span>:<span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:peter&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;peter&#34;</span>,<span style=color:#4e9a06>&#34;age&#34;</span>:35,<span style=color:#4e9a06>&#34;city&#34;</span>:<span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:vadas&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;vadas&#34;</span>,<span style=color:#4e9a06>&#34;age&#34;</span>:27,<span style=color:#4e9a06>&#34;city&#34;</span>:<span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#ce5c00;font-weight:700>}}</span>,<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;id&#34;</span>:<span style=color:#4e9a06>&#34;1:li,nary&#34;</span>,<span style=color:#4e9a06>&#34;label&#34;</span>:<span style=color:#4e9a06>&#34;person&#34;</span>,<span style=color:#4e9a06>&#34;type&#34;</span>:<span style=color:#4e9a06>&#34;vertex&#34;</span>,<span style=color:#4e9a06>&#34;properties&#34;</span>:<span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;li,nary&#34;</span>,<span style=color:#4e9a06>&#34;age&#34;</span>:26,<span style=color:#4e9a06>&#34;city&#34;</span>:<span style=color:#4e9a06>&#34;Wu,han&#34;</span><span style=color:#ce5c00;font-weight:700>}}]}</span>
</span></span></code></pre></div><p>如果想检查边的导入结果,可以使用 <code>curl "http://localhost:8080/graphs/hugegraph/graph/edges" | gunzip</code></p><h5 id=452-进入-docker-容器进行导入>4.5.2 进入 docker 容器进行导入</h5><p>除了直接使用 <code>docker exec</code> 导入数据,我们也可以进入容器进行数据导入,基本流程与 <a href=#451-%E4%BD%BF%E7%94%A8-docker-exec-%E7%9B%B4%E6%8E%A5%E5%AF%BC%E5%85%A5%E6%95%B0%E6%8D%AE>4.5.1</a> 相同</p><p>使用 <code>docker exec -it loader bash</code>进入容器内部,并执行命令</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h server -p <span style=color:#0000cf;font-weight:700>8080</span>
</span></span></code></pre></div><p>执行的结果如 <a href=#451-%E4%BD%BF%E7%94%A8-docker-exec-%E7%9B%B4%E6%8E%A5%E5%AF%BC%E5%85%A5%E6%95%B0%E6%8D%AE>4.5.1</a> 所示</p><h4 id=46-使用-spark-loader-导入>4.6 使用 spark-loader 导入</h4><blockquote><p>Spark 版本:Spark 3+,其他版本未测试。
HugeGraph Toolchain 版本:toolchain-1.0.0</p></blockquote><p><code>spark-loader</code> 的参数分为两部分,注意:因二者参数名缩写存在重合部分,请使用参数全称。两种参数之间无需保证先后顺序。</p><ul><li>hugegraph 参数(参考:<a href=https://hugegraph.apache.org/cn/docs/quickstart/hugegraph-loader/#341-%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E>hugegraph-loader 参数说明</a></li><li>Spark 任务提交参数(参考:<a href=https://spark.apache.org/docs/3.3.0/submitting-applications.html#content>Submitting Applications</a></li></ul><p>示例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>sh bin/hugegraph-spark-loader.sh --master yarn <span style=color:#4e9a06>\
</span></span></span><span style=display:flex><span><span style=color:#4e9a06></span>--deploy-mode cluster --name spark-hugegraph-loader --file ./hugegraph.json <span style=color:#4e9a06>\
</span></span></span><span style=display:flex><span><span style=color:#4e9a06></span>--username admin --token admin --host xx.xx.xx.xx --port <span style=color:#0000cf;font-weight:700>8093</span> <span style=color:#4e9a06>\
</span></span></span><span style=display:flex><span><span style=color:#4e9a06></span>--graph graph-test --num-executors <span style=color:#0000cf;font-weight:700>6</span> --executor-cores <span style=color:#0000cf;font-weight:700>16</span> --executor-memory 15g
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-751ed124ec6dbb96d5e65c62dc9d4e85>3.3 - HugeGraph-Hubble Quick Start</h1><h3 id=1-hugegraph-hubble-概述>1 HugeGraph-Hubble 概述</h3><blockquote><p><strong>注:</strong> 当前版本的 Hubble 还没有添加 Auth/Login 相关界面和接口和单独防护, 在下一个 Release 版 (≥ 1.5) 会加入,
请留意避免把它暴露在公网环境或不受信任的网络中,以免引起相关 SEC 问题 (另外也可以使用 IP & 端口白名单 + HTTPS)</p></blockquote><p><strong>HugeGraph-Hubble</strong> 是 HugeGraph 的一站式可视化分析平台,平台涵盖了从数据建模,到数据快速导入,
再到数据的在线、离线分析、以及图的统一管理的全过程,实现了图应用的全流程向导式操作,旨在提升用户的使用流畅度,
降低用户的使用门槛,提供更为高效易用的使用体验。</p><p>平台主要包括以下模块:</p><h5 id=图管理>图管理</h5><p>图管理模块通过图的创建,连接平台与图数据,实现多图的统一管理,并实现图的访问、编辑、删除、查询操作。</p><h5 id=元数据建模>元数据建模</h5><p>元数据建模模块通过创建属性库,顶点类型,边类型,索引类型,实现图模型的构建与管理,平台提供两种模式,列表模式和图模式,可实时展示元数据模型,更加直观。同时还提供了跨图的元数据复用功能,省去相同元数据繁琐的重复创建过程,极大地提升建模效率,增强易用性。</p><h5 id=图分析>图分析</h5><p>通过输入图遍历语言 Gremlin 可实现图数据的高性能通用分析,并提供顶点的定制化多维路径查询等功能,提供 3 种图结果展示方式,包括:图形式、表格形式、Json 形式,多维度展示数据形态,满足用户使用的多种场景需求。提供运行记录及常用语句收藏等功能,实现图操作的可追溯,以及查询输入的复用共享,快捷高效。支持图数据的导出,导出格式为 Json 格式。</p><h5 id=任务管理>任务管理</h5><p>对于需要遍历全图的 Gremlin 任务,索引的创建与重建等耗时较长的异步任务,平台提供相应的任务管理功能,实现异步任务的统一的管理与结果查看。</p><h5 id=数据导入-beta>数据导入 (BETA)</h5><blockquote><p>注: 数据导入功能目前适合初步试用,正式数据导入请使用 <a href=/cn/docs/quickstart/hugegraph-loader>hugegraph-loader</a>, 性能/稳定性/功能全面许多</p></blockquote><p>数据导入是将用户的业务数据转化为图的顶点和边并插入图数据库中,平台提供了向导式的可视化导入模块,通过创建导入任务,
实现导入任务的管理及多个导入任务的并行运行,提高导入效能。进入导入任务后,只需跟随平台步骤提示,按需上传文件,填写内容,
就可轻松实现图数据的导入过程,同时支持断点续传,错误重试机制等,降低导入成本,提升效率。</p><h3 id=2-部署>2 部署</h3><p>有三种方式可以部署<code>hugegraph-hubble</code></p><ul><li>使用 docker (便于<strong>测试</strong>)</li><li>下载 toolchain 二进制包</li><li>源码编译</li></ul><h4 id=21-使用-docker-便于测试>2.1 使用 Docker (便于<strong>测试</strong>)</h4><blockquote><p><strong>特别注意</strong>: docker 模式下,若 hubble 和 server 在同一宿主机,hubble 页面中设置 server 的 <code>hostname</code> <strong>不能设置</strong><code>localhost/127.0.0.1</code>,因这会指向 hubble <strong>容器内部</strong>而非宿主机,导致无法连接到 server.</p><p>若 hubble 和 server 在同一 docker 网络下,<strong>推荐</strong>直接使用<code>container_name</code> (如下例的 <code>server</code>) 作为主机名。或者也可以使用 <strong>宿主机 IP</strong> 作为主机名,此时端口号为宿主机给 server 配置的端口</p></blockquote><p>我们可以使用 <code>docker run -itd --name=hubble -p 8088:8088 hugegraph/hubble</code> 快速启动 <a href=https://hub.docker.com/r/hugegraph/hubble>hubble</a>.</p><p>或者使用 docker-compose 启动 hubble,另外如果 hubble 和 server 在同一个 docker 网络下,可以使用 server 的 contain_name 进行访问,而不需要宿主机的 ip</p><p>使用<code>docker-compose up -d</code><code>docker-compose.yml</code>如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;3&#39;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hubble</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hubble</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hubble</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8088</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8088</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><blockquote><p>注意:</p><ol><li><p><code>hugegraph-hubble</code> 的 docker 镜像是一个便捷发布版本,用于快速测试试用 hubble,并非<strong>ASF 官方发布物料包的方式</strong>。你可以从 <a href=https://infra.apache.org/release-distribution.html#dockerhub>ASF Release Distribution Policy</a> 中得到更多细节。</p></li><li><p><strong>生产环境</strong>推荐使用 <code>release tag</code>(如 <code>1.2.0</code>) 稳定版。使用 <code>latest</code> tag 默认对应 master 最新代码。</p></li></ol></blockquote><h4 id=22-下载-toolchain-二进制包>2.2 下载 toolchain 二进制包</h4><p><code>hubble</code>项目在<code>toolchain</code>项目中,首先下载<code>toolchain</code>的 tar 包</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>/apache-hugegraph-toolchain-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>.tar.gz
</span></span><span style=display:flex><span>tar -xvf apache-hugegraph-toolchain-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>.tar.gz
</span></span><span style=display:flex><span><span style=color:#204a87>cd</span> apache-hugegraph-toolchain-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>.tar.gz/apache-hugegraph-hubble-incubating-<span style=color:#ce5c00;font-weight:700>{</span>version<span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><p>运行<code>hubble</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hubble.sh
</span></span></code></pre></div><p>随后我们可以看到</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>starting HugeGraphHubble ..............timed out with http status <span style=color:#0000cf;font-weight:700>502</span>
</span></span><span style=display:flex><span>2023-08-30 20:38:34 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> o.a.h.HugeGraphHubble <span style=color:#ce5c00;font-weight:700>[]</span> - Starting HugeGraphHubble v1.0.0 on cpu05 with PID xxx <span style=color:#ce5c00;font-weight:700>(</span>~/apache-hugegraph-toolchain-incubating-1.0.0/apache-hugegraph-hubble-incubating-1.0.0/lib/hubble-be-1.0.0.jar started by <span style=color:#000>$USER</span> in ~/apache-hugegraph-toolchain-incubating-1.0.0/apache-hugegraph-hubble-incubating-1.0.0<span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>...
</span></span><span style=display:flex><span>2023-08-30 20:38:38 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> c.z.h.HikariDataSource <span style=color:#ce5c00;font-weight:700>[]</span> - hugegraph-hubble-HikariCP - Start completed.
</span></span><span style=display:flex><span>2023-08-30 20:38:41 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> o.a.c.h.Http11NioProtocol <span style=color:#ce5c00;font-weight:700>[]</span> - Starting ProtocolHandler <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#4e9a06>&#34;http-nio-0.0.0.0-8088&#34;</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span>2023-08-30 20:38:41 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO <span style=color:#ce5c00;font-weight:700>]</span> o.a.h.HugeGraphHubble <span style=color:#ce5c00;font-weight:700>[]</span> - Started HugeGraphHubble in 7.379 seconds <span style=color:#ce5c00;font-weight:700>(</span>JVM running <span style=color:#204a87;font-weight:700>for</span> 8.499<span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p>然后使用浏览器访问 <code>ip:8088</code> 可看到<code>hubble</code>页面,通过<code>bin/stop-hubble.sh</code>则可以停止服务</p><h4 id=23-源码编译>2.3 源码编译</h4><p><strong>注意:</strong> 编译 hubble 需要用户本地环境有安装 <code>Nodejs V16.x</code><code>yarn</code> 环境</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>apt install curl build-essential
</span></span><span style=display:flex><span>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh <span style=color:#000;font-weight:700>|</span> bash
</span></span><span style=display:flex><span><span style=color:#204a87>source</span> ~/.bashrc
</span></span><span style=display:flex><span>nvm install <span style=color:#0000cf;font-weight:700>16</span>
</span></span></code></pre></div><p>然后确认安装版本是否为 <code>16.x</code> (请注意过高的 Node 版本会产生冲突)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>node -v
</span></span></code></pre></div><p>使用下列命令安装 <code>yarn</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>npm install -g yarn
</span></span></code></pre></div><p>下载 toolchain 源码包</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>git clone https://github.com/apache/hugegraph-toolchain.git
</span></span></code></pre></div><p>编译<code>hubble</code>, 它依赖 loader 和 client, 编译时需提前构建这些依赖 (后续可跳)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#204a87>cd</span> incubator-hugegraph-toolchain
</span></span><span style=display:flex><span>sudo pip install -r hugegraph-hubble/hubble-dist/assembly/travis/requirements.txt
</span></span><span style=display:flex><span>mvn install -pl hugegraph-client,hugegraph-loader -am -Dmaven.javadoc.skip<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87>true</span> -DskipTests -ntp
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph-hubble
</span></span><span style=display:flex><span>mvn -e package -Dmaven.javadoc.skip<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87>true</span> -Dmaven.test.skip<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87>true</span> -ntp
</span></span><span style=display:flex><span><span style=color:#204a87>cd</span> apache-hugegraph-hubble-incubating*
</span></span></code></pre></div><p>启动<code>hubble</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-hubble.sh -d
</span></span></code></pre></div><h3 id=3平台使用流程>3 平台使用流程</h3><p>平台的模块使用流程如下:</p><div style=text-align:center><img src=/docs/images/images-hubble/2平台使用流程.png alt=image></div><h3 id=4平台使用说明>4 平台使用说明</h3><h4 id=41图管理>4.1 图管理</h4><h5 id=411图创建>4.1.1 图创建</h5><p>图管理模块下,点击【创建图】,通过填写图 ID、图名称、主机名、端口号、用户名、密码的信息,实现多图的连接。</p><div style=text-align:center><img src=/docs/images/images-hubble/311图创建.png alt=image></div><p>创建图填写内容如下:</p><div style=text-align:center><img src=/docs/images/images-hubble/311图创建2.png alt=image></div><blockquote><p><strong>注意</strong>:如果使用 docker 启动 <code>hubble</code>,且 <code>server</code><code>hubble</code> 位于同一宿主机,不能直接使用 <code>localhost/127.0.0.1</code> 作为主机名。如果 <code>hubble</code><code>server</code> 在同一 docker 网络下,则可以直接使用 container_name 作为主机名,端口则为 8080。或者也可以使用宿主机 ip 作为主机名,此时端口为宿主机为 server 配置的端口</p></blockquote><h5 id=412图访问>4.1.2 图访问</h5><p>实现图空间的信息访问,进入后,可进行图的多维查询分析、元数据管理、数据导入、算法分析等操作。</p><div style=text-align:center><img src=/docs/images/images-hubble/312图访问.png alt=image></div><h5 id=413图管理>4.1.3 图管理</h5><ol><li>用户通过对图的概览、搜索以及单图的信息编辑与删除,实现图的统一管理。</li><li>搜索范围:可对图名称和 ID 进行搜索。</li></ol><div style=text-align:center><img src=/docs/images/images-hubble/313图管理.png alt=image></div><h4 id=42元数据建模列表--图模式>4.2 元数据建模(列表 + 图模式)</h4><h5 id=421模块入口>4.2.1 模块入口</h5><p>左侧导航处:</p><div style=text-align:center><img src=/docs/images/images-hubble/321元数据入口.png alt=image></div><h5 id=422属性类型>4.2.2 属性类型</h5><h6 id=4221创建>4.2.2.1 创建</h6><ol><li>填写或选择属性名称、数据类型、基数,完成属性的创建。</li><li>创建的属性可作为顶点类型和边类型的属性。</li></ol><p>列表模式:</p><div style=text-align:center><img src=/docs/images/images-hubble/3221属性创建.png alt=image></div><p>图模式:</p><div style=text-align:center><img src=/docs/images/images-hubble/3221属性创建2.png alt=image></div><h6 id=4222复用>4.2.2.2 复用</h6><ol><li>平台提供【复用】功能,可直接复用其他图的元数据。</li><li>选择需要复用的图 ID,继续选择需要复用的属性,之后平台会进行是否冲突的校验,通过后,可实现元数据的复用。</li></ol><p>选择复用项:</p><div style=text-align:center><img src=/docs/images/images-hubble/3222属性复用.png alt=image></div><p>校验复用项:</p><div style=text-align:center><img src=/docs/images/images-hubble/3222属性复用2.png alt=image></div><h6 id=4223管理>4.2.2.3 管理</h6><ol><li>在属性列表中可进行单条删除或批量删除操作。</li></ol><h5 id=423顶点类型>4.2.3 顶点类型</h5><h6 id=4231创建>4.2.3.1 创建</h6><ol><li>填写或选择顶点类型名称、ID 策略、关联属性、主键属性,顶点样式、查询结果中顶点下方展示的内容,以及索引的信息:包括是否创建类型索引,及属性索引的具体内容,完成顶点类型的创建。</li></ol><p>列表模式:</p><center><img src=/docs/images/images-hubble/3231顶点创建.png alt=image></center><p>图模式:</p><center><img src=/docs/images/images-hubble/3231顶点创建2.png alt=image></center><h6 id=4232复用>4.2.3.2 复用</h6><ol><li>顶点类型的复用,会将此类型关联的属性和属性索引一并复用。</li><li>复用功能使用方法类似属性的复用,见 3.2.2.2。</li></ol><h6 id=4233管理>4.2.3.3 管理</h6><ol><li><p>可进行编辑操作,顶点样式、关联类型、顶点展示内容、属性索引可编辑,其余不可编辑。</p></li><li><p>可进行单条删除或批量删除操作。</p></li></ol><center><img src=/docs/images/images-hubble/3233顶点删除.png alt=image></center><h5 id=424边类型>4.2.4 边类型</h5><h6 id=4241创建>4.2.4.1 创建</h6><ol><li>填写或选择边类型名称、起点类型、终点类型、关联属性、是否允许多次连接、边样式、查询结果中边下方展示的内容,以及索引的信息:包括是否创建类型索引,及属性索引的具体内容,完成边类型的创建。</li></ol><p>列表模式:</p><center><img src=/docs/images/images-hubble/3241边创建.png alt=image></center><p>图模式:</p><center><img src=/docs/images/images-hubble/3241边创建2.png alt=image></center><h6 id=4242复用>4.2.4.2 复用</h6><ol><li>边类型的复用,会将此类型的起点类型、终点类型、关联的属性和属性索引一并复用。</li><li>复用功能使用方法类似属性的复用,见 3.2.2.2。</li></ol><h6 id=4243管理>4.2.4.3 管理</h6><ol><li>可进行编辑操作,边样式、关联属性、边展示内容、属性索引可编辑,其余不可编辑,同顶点类型。</li><li>可进行单条删除或批量删除操作。</li></ol><h5 id=425索引类型>4.2.5 索引类型</h5><p>展示顶点类型和边类型的顶点索引和边索引。</p><h4 id=43数据导入>4.3 数据导入</h4><blockquote><p><strong>注意</strong>:目前推荐使用 <a href=/cn/docs/quickstart/hugegraph-loader>hugegraph-loader</a> 进行正式数据导入,hubble 内置的导入用来做<strong>测试</strong><strong>简单上手</strong></p></blockquote><p>数据导入的使用流程如下:</p><center><img src=/docs/images/images-hubble/33导入流程.png alt=image></center><h5 id=431模块入口>4.3.1 模块入口</h5><p>左侧导航处:</p><center><img src=/docs/images/images-hubble/331导入入口.png alt=image></center><h5 id=432创建任务>4.3.2 创建任务</h5><ol><li>填写任务名称和备注(非必填),可以创建导入任务。</li><li>可创建多个导入任务,并行导入。</li></ol><center><img src=/docs/images/images-hubble/332创建任务.png alt=image></center><h5 id=433上传文件>4.3.3 上传文件</h5><ol><li>上传需要构图的文件,目前支持的格式为 CSV,后续会不断更新。</li><li>可同时上传多个文件。</li></ol><center><img src=/docs/images/images-hubble/333上传文件.png alt=image></center><h5 id=434设置数据映射>4.3.4 设置数据映射</h5><ol><li><p>对上传的文件分别设置数据映射,包括文件设置和类型设置</p></li><li><p>文件设置:勾选或填写是否包含表头、分隔符、编码格式等文件本身的设置内容,均设置默认值,无需手动填写</p></li><li><p>类型设置:</p><ol><li><p>顶点映射和边映射:</p><p>【顶点类型】 :选择顶点类型,并为其 ID 映射上传文件中列数据;</p><p>【边类型】:选择边类型,为其起点类型和终点类型的 ID 列映射上传文件的列数据;</p></li><li><p>映射设置:为选定的顶点类型的属性映射上传文件中的列数据,此处,若属性名称与文件的表头名称一致,可自动匹配映射属性,无需手动填选</p></li><li><p>完成设置后,显示设置列表,方可进行下一步操作,支持映射的新增、编辑、删除操作</p></li></ol></li></ol><p>设置映射的填写内容:</p><center><img src=/docs/images/images-hubble/334设置映射.png alt=image></center><p>映射列表:</p><center><img src=/docs/images/images-hubble/334设置映射2.png alt=image></center><h5 id=435导入数据>4.3.5 导入数据</h5><p>导入前需要填写导入设置参数,填写完成后,可开始向图库中导入数据</p><ol><li>导入设置</li></ol><ul><li>导入设置参数项如下图所示,均设置默认值,无需手动填写</li></ul><center><img src=/docs/images/images-hubble/335导入设置.png alt=image></center><ol start=2><li>导入详情</li></ol><ul><li>点击开始导入,开始文件的导入任务</li><li>导入详情中提供每个上传文件设置的映射类型、导入速度、导入的进度、耗时以及当前任务的具体状态,并可对每个任务进行暂停、继续、停止等操作</li><li>若导入失败,可查看具体原因</li></ul><center><img src=/docs/images/images-hubble/335导入详情.png alt=image></center><h4 id=44数据分析>4.4 数据分析</h4><h5 id=441模块入口>4.4.1 模块入口</h5><p>左侧导航处:</p><center><img src=/docs/images/images-hubble/341分析入口.png alt=image></center><h5 id=442多图切换>4.4.2 多图切换</h5><p>通过左侧切换入口,灵活切换多图的操作空间</p><center><img src=/docs/images/images-hubble/342多图切换.png alt=image></center><h5 id=443图分析与处理>4.4.3 图分析与处理</h5><p>HugeGraph 支持 Apache TinkerPop3 的图遍历查询语言 Gremlin,Gremlin 是一种通用的图数据库查询语言,通过输入 Gremlin 语句,点击执行,即可执行图数据的查询分析操作,并可实现顶点/边的创建及删除、顶点/边的属性修改等。</p><p>Gremlin 查询后,下方为图结果展示区域,提供 3 种图结果展示方式,分别为:【图模式】、【表格模式】、【Json 模式】。</p><p>支持缩放、居中、全屏、导出等操作。</p><p>【图模式】</p><center><img src=/docs/images/images-hubble/343图分析-图.png alt=image></center><p>【表格模式】</p><center><img src=/docs/images/images-hubble/343图分析-表格.png alt=image></center><p>【Json 模式】</p><center><img src=/docs/images/images-hubble/343图分析-json.png alt=image></center><h5 id=444数据详情>4.4.4 数据详情</h5><p>点击顶点/边实体,可查看顶点/边的数据详情,包括:顶点/边类型,顶点 ID,属性及对应值,拓展图的信息展示维度,提高易用性。</p><h5 id=445图结果的多维路径查询>4.4.5 图结果的多维路径查询</h5><p>除了全局的查询外,可针对查询结果中的顶点进行深度定制化查询以及隐藏操作,实现图结果的定制化挖掘。</p><p>右击顶点,出现顶点的菜单入口,可进行展示、查询、隐藏等操作。</p><ul><li>展开:点击后,展示与选中点关联的顶点。</li><li>查询:通过选择与选中点关联的边类型及边方向,在此条件下,再选择其属性及相应筛选规则,可实现定制化的路径展示。</li><li>隐藏:点击后,隐藏选中点及与之关联的边。</li></ul><p>双击顶点,也可展示与选中点关联的顶点。</p><center><img src=/docs/images/images-hubble/345定制路径查询.png alt=image></center><h5 id=446新增顶点边>4.4.6 新增顶点/边</h5><h6 id=4461新增顶点>4.4.6.1 新增顶点</h6><p>在图区可通过两个入口,动态新增顶点,如下:</p><ol><li>点击图区面板,出现添加顶点入口</li><li>点击右上角的操作栏中的首个图标</li></ol><p>通过选择或填写顶点类型、ID 值、属性信息,完成顶点的增加。</p><p>入口如下:</p><center><img src=/docs/images/images-hubble/346新增顶点.png alt=image></center><p>添加顶点内容如下:</p><center><img src=/docs/images/images-hubble/346新增顶点2.png alt=image></center><h6 id=4462新增边>4.4.6.2 新增边</h6><p>右击图结果中的顶点,可增加该点的出边或者入边。</p><h5 id=447执行记录与收藏的查询>4.4.7 执行记录与收藏的查询</h5><ol><li>图区下方记载每次查询记录,包括:查询时间、执行类型、内容、状态、耗时、以及【收藏】和【加载】操作,实现图执行的全方位记录,有迹可循,并可对执行内容快速加载复用</li><li>提供语句的收藏功能,可对常用语句进行收藏操作,方便高频语句快速调用</li></ol><center><img src=/docs/images/images-hubble/347收藏.png alt=image></center><h4 id=45任务管理>4.5 任务管理</h4><h5 id=451模块入口>4.5.1 模块入口</h5><p>左侧导航处:</p><center><img src=/docs/images/images-hubble/351任务管理入口.png alt=image></center><h5 id=452任务管理>4.5.2 任务管理</h5><ol><li>提供异步任务的统一的管理与结果查看,异步任务包括 4 类,分别为:</li></ol><ul><li>gremlin:Gremlin 任务务</li><li>algorithm:OLAP 算法任务务</li><li>remove_schema:删除元数据</li><li>rebuild_index:重建索引</li></ul><ol start=2><li>列表显示当前图的异步任务信息,包括:任务 ID,任务名称,任务类型,创建时间,耗时,状态,操作,实现对异步任务的管理。</li><li>支持对任务类型和状态进行筛选</li><li>支持搜索任务 ID 和任务名称</li><li>可对异步任务进行删除或批量删除操作</li></ol><center><img src=/docs/images/images-hubble/352任务列表.png alt=image></center><h5 id=453gremlin-异步任务>4.5.3 Gremlin 异步任务</h5><p>1.创建任务</p><ul><li>数据分析模块,目前支持两种 Gremlin 操作,Gremlin 查询和 Gremlin 任务;若用户切换到 Gremlin 任务,点击执行后,在异步任务中心会建立一条异步任务;
2.任务提交</li><li>任务提交成功后,图区部分返回提交结果和任务 ID
3.任务详情</li><li>提供【查看】入口,可跳转到任务详情查看当前任务具体执行情况跳转到任务中心后,直接显示当前执行的任务行</li></ul><center><img src=/docs/images/images-hubble/353gremlin任务.png alt=image></center><p>点击查看入口,跳转到任务管理列表,如下:</p><center><img src=/docs/images/images-hubble/353gremlin任务2.png alt=image></center><p>4.查看结果</p><ul><li>结果通过 json 形式展示</li></ul><h5 id=454olap-算法任务>4.5.4 OLAP 算法任务</h5><p>Hubble 上暂未提供可视化的 OLAP 算法执行,可调用 RESTful API 进行 OLAP 类算法任务,在任务管理中通过 ID 找到相应任务,查看进度与结果等。</p><h5 id=455删除元数据重建索引>4.5.5 删除元数据、重建索引</h5><p>1.创建任务</p><ul><li>在元数据建模模块中,删除元数据时,可建立删除元数据的异步任务</li></ul><center><img src=/docs/images/images-hubble/355删除元数据.png alt=image></center><ul><li>在编辑已有的顶点/边类型操作中,新增索引时,可建立创建索引的异步任务</li></ul><center><img src=/docs/images/images-hubble/355构建索引.png alt=image></center><p>2.任务详情</p><ul><li>确认/保存后,可跳转到任务中心查看当前任务的详情</li></ul><center><img src=/docs/images/images-hubble/355任务详情.png alt=image></center></div><div class=td-content style=page-break-before:always><h1 id=pg-405910066a042ce44a1c5798042ab119>3.4 - HugeGraph-AI Quick Start</h1><h3 id=1-hugegraph-ai-概述>1 HugeGraph-AI 概述</h3><p>hugegraph-ai 旨在探索 HugeGraph 与人工智能(AI)的融合,包括与大模型结合的应用,与图机器学习组件的集成等,为开发者在项目中利用 HugeGraph
的 AI 能力提供全面支持。</p><h3 id=2-环境要求>2 环境要求</h3><ul><li>python 3.8+</li><li>hugegraph 1.0.0+</li></ul><h3 id=3-准备工作>3 准备工作</h3><ul><li>启动 HugeGraph 数据库,你可以通过 Docker 来实现。请参考这个<a href=https://hub.docker.com/r/hugegraph/hugegraph>链接</a>获取指引。</li><li>启动 gradio 交互式 demo,你可以通过以下命令启动,启动后打开 <a href=http://127.0.0.1:8001>http://127.0.0.1:8001</a></li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># ${PROJECT_ROOT_DIR} 为 hugegraph-ai 的根目录,需要自行配置</span>
</span></span><span style=display:flex><span><span style=color:#204a87>export</span> <span style=color:#000>PYTHONPATH</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>${</span><span style=color:#000>PROJECT_ROOT_DIR</span><span style=color:#4e9a06>}</span>/hugegraph-llm/src:<span style=color:#4e9a06>${</span><span style=color:#000>PROJECT_ROOT_DIR</span><span style=color:#4e9a06>}</span>/hugegraph-python-client/src
</span></span><span style=display:flex><span>python3 ./hugegraph-llm/src/hugegraph_llm/utils/gradio_demo.py
</span></span></code></pre></div><ul><li>配置 HugeGraph 数据库连接信息和 LLM 模型信息,可以通过两种方式配置:<ol><li>配置 <code>./hugegraph-llm/src/config/config.ini</code> 文件</li><li>在 gradio 中,分别完成 LLM 和 HugeGraph 的配置后,点击 <code>Initialize configs</code>,将返回初始化后的完整配置文件。如图所示:
<img src=/docs/images/gradio-config.png alt="gradio 配置"></li></ol></li><li>离线下载 NLTK stopwords</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>python3 ./hugegraph_llm/operators/common_op/nltk_helper.py
</span></span></code></pre></div><h3 id=4-使用说明>4 使用说明</h3><h4 id=41-通过-llm-在-hugegraph-中构建知识图谱>4.1 通过 LLM 在 HugeGraph 中构建知识图谱</h4><h5 id=411-通过-gradio-交互式界面构建知识图谱>4.1.1 通过 gradio 交互式界面构建知识图谱</h5><ul><li>参数说明:<ul><li>Text: 输入的文本。</li><li>Schema:接受以下两种类型的文本:<ul><li>用户定义的 JSON 格式模式。</li><li>指定 HugeGraph 图实例的名称,它将自动提取图的模式。</li></ul></li><li>Disambiguate word sense:是否进行词义消除歧义。</li><li>Commit to hugegraph:是否将构建的知识图谱提交到 HugeGraph 服务器</li></ul></li></ul><p><img src=/docs/images/gradio-kg.png alt="gradio 配置"></p><h5 id=412-通过代码构建知识图谱>4.1.2 通过代码构建知识图谱</h5><ul><li>完整代码</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#204a87;font-weight:700>from</span> <span style=color:#000>hugegraph_llm.llms.init_llm</span> <span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>LLMs</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>from</span> <span style=color:#000>hugegraph_llm.operators.kg_construction_task</span> <span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>KgBuilder</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>llm</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>LLMs</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>get_llm</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>KgBuilder</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>llm</span><span style=color:#000;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>(</span>
</span></span><span style=display:flex><span> <span style=color:#000>builder</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>import_schema</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>from_hugegraph</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;test_graph&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>extract_triples</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>TEXT</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>disambiguate_word_sense</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>commit_to_hugegraph</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>run</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>)</span>
</span></span></code></pre></div><ul><li>时序图
<img src=/docs/images/kg-uml.png alt="gradio 配置"></li></ul><ol><li>初始化:初始化 LLMs 实例,获取 LLM,然后创建图谱构建的任务实例 <code>KgBuilder</code>,KgBuilder 中定义了多个 operator,用户可以根据需求自由组合达到目的。(tip: <code>print_result()</code> 可以在控制台打印每一步输出的结果,不影响整体执行逻辑)</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>llm</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>LLMs</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>get_llm</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>KgBuilder</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>llm</span><span style=color:#000;font-weight:700>)</span>
</span></span></code></pre></div><ol start=2><li>导入 Schema:使用 <code>import_schema</code> 方法导入,支持三种模式:<ul><li>从 HugeGraph 实例导入,指定 HugeGraph 图实例的名称,它将自动提取图的模式。</li><li>从用户定义的模式导入,接受用户定义的 JSON 格式模式。</li><li>从提取结果导入(即将发布)</li></ul></li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Import schema from a HugeGraph instance</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>import_schema</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>from_hugegraph</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;test_graph&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Import schema from user-defined schema</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>import_schema</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>from_user_defined</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;xxx&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Import schema from an extraction result</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>import_schema</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>from_extraction</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;xxx&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=3><li>提取三元组:使用 <code>extract_triples</code> 方法从文本中提取三元组。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>TEXT</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;Meet Sarah, a 30-year-old attorney, and her roommate, James, whom she&#39;s shared a home with since 2010.&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>extract_triples</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>TEXT</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=4><li>消除词义歧义:使用 <code>disambiguate_word_sense</code> 方法消除词义歧义。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>disambiguate_word_sense</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=5><li>提交到 HugeGraph:使用 <code>commit_to_hugegraph</code> 方法提交构建的知识图谱到 HugeGraph 实例。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>commit_to_hugegraph</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=6><li>运行:使用 <code>run</code> 方法执行上述操作。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>run</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=42-基于-hugegraph-的检索增强生成rag>4.2 基于 HugeGraph 的检索增强生成(RAG)</h4><h5 id=411-通过-gradio-交互问答>4.1.1 通过 gradio 交互问答</h5><ol><li>首先点击 <code>Initialize HugeGraph test data</code> 按钮,初始化 HugeGraph 数据。
<img src=/docs/images/gradio-rag-1.png alt="gradio 配置"></li><li>然后点击 <code>Retrieval augmented generation</code> 按钮,生成问题的答案。
<img src=/docs/images/gradio-rag-2.png alt="gradio 配置"></li></ol><h5 id=412-通过代码构建-graph-rag>4.1.2 通过代码构建 Graph RAG</h5><ul><li>完整代码</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>graph_rag</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>GraphRAG</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>result</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000;font-weight:700>(</span>
</span></span><span style=display:flex><span> <span style=color:#000>graph_rag</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>extract_keyword</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>text</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;Tell me about Al Pacino.&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>query_graph_for_rag</span><span style=color:#000;font-weight:700>(</span>
</span></span><span style=display:flex><span> <span style=color:#000>max_deep</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>max_items</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>synthesize_answer</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>run</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>verbose</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87;font-weight:700>True</span><span style=color:#000;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>)</span>
</span></span></code></pre></div><ol><li>extract_keyword: 提取关键词, 并进行近义词扩展</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>graph_rag</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>extract_keyword</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>text</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>&#34;Tell me about Al Pacino.&#34;</span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=2><li>query_graph_for_rag: 从 HugeGraph 中检索对应的关键词,及其多度的关联关系<ul><li>max_deep: hugegraph 检索的最大深度</li><li>max_items: hugegraph 最大返回结果数</li></ul></li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>graph_rag</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>query_graph_for_rag</span><span style=color:#000;font-weight:700>(</span>
</span></span><span style=display:flex><span> <span style=color:#000>max_deep</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>max_items</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>)</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=3><li>synthesize_answer: 针对提问,汇总结果,组织语言回答问题。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>graph_rag</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>synthesize_answer</span><span style=color:#000;font-weight:700>()</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>print_result</span><span style=color:#000;font-weight:700>()</span>
</span></span></code></pre></div><ol start=4><li>run: 执行上述操作。</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-python data-lang=python><span style=display:flex><span><span style=color:#000>graph_rag</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#000>run</span><span style=color:#000;font-weight:700>(</span><span style=color:#000>verbose</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87;font-weight:700>True</span><span style=color:#000;font-weight:700>)</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-9cbf1b01e876dc8cdc2da1c17759eed3>3.5 - HugeGraph-Client Quick Start</h1><h3 id=1-hugegraph-client-概述>1 HugeGraph-Client 概述</h3><p><a href=https://github.com/apache/hugegraph-toolchain>HugeGraph-Client</a> 向 HugeGraph-Server 发出 HTTP 请求,获取并解析 Server 的执行结果。
提供了 Java/Go/<a href=https://github.com/apache/incubator-hugegraph-ai/tree/main/hugegraph-python-client>Python</a> 版,
用户可以使用 <a href=/cn/docs/clients/hugegraph-client>Client-API</a> 编写代码操作 HugeGraph,比如元数据和图数据的增删改查,或者执行 gremlin 语句等。
后文主要是 Java 使用示例 (其他语言 SDK 可参考对应 <code>READEME</code> 页面)</p><blockquote><p>现在已经支持基于 Go 语言的 HugeGraph <a href=https://github.com/apache/incubator-hugegraph-toolchain/blob/master/hugegraph-client-go/README.md>Client SDK</a> (version >=1.2.0)</p></blockquote><h3 id=2-环境要求>2 环境要求</h3><ul><li>java 11 (兼容 java 8)</li><li>maven 3.5+</li></ul><h3 id=3-使用流程>3 使用流程</h3><p>使用 HugeGraph-Client 的基本步骤如下:</p><ul><li>新建Eclipse/ IDEA Maven 项目;</li><li>在 pom 文件中添加 HugeGraph-Client 依赖;</li><li>创建类,调用 HugeGraph-Client 接口;</li></ul><p>详细使用过程见下节完整示例。</p><h3 id=4-完整示例>4 完整示例</h3><h4 id=41-新建-maven-工程>4.1 新建 Maven 工程</h4><p>可以选择 Eclipse 或者 Intellij Idea 创建工程:</p><ul><li><a href=http://www.vogella.com/tutorials/EclipseMaven/article.html>Eclipse 新建 Maven 工程</a></li><li><a href=https://vaadin.com/docs/-/part/framework/getting-started/getting-started-idea.html>Intellij Idea 创建 maven 工程</a></li></ul><h4 id=42-添加-hugegraph-client-依赖>4.2 添加 hugegraph-client 依赖</h4><p>添加 hugegraph-client 依赖</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&lt;dependencies&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;dependency&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;groupId&gt;</span>org.apache.hugegraph<span style=color:#204a87;font-weight:700>&lt;/groupId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;artifactId&gt;</span>hugegraph-client<span style=color:#204a87;font-weight:700>&lt;/artifactId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>&lt;!-- Update to the latest release version --&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;version&gt;</span>1.3.0<span style=color:#204a87;font-weight:700>&lt;/version&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;/dependency&gt;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&lt;/dependencies&gt;</span>
</span></span></code></pre></div><blockquote><p>注:Graph 所有组件版本号均保持一致</p></blockquote><h4 id=43-example>4.3 Example</h4><h5 id=431-singleexample>4.3.1 SingleExample</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.io.IOException</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.Iterator</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.List</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.GraphManager</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.GremlinManager</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.HugeClient</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.SchemaManager</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.constant.T</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.graph.Edge</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.graph.Path</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.graph.Vertex</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.gremlin.Result</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.gremlin.ResultSet</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>SingleExample</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>[]</span> <span style=color:#000>args</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#204a87;font-weight:700>throws</span> <span style=color:#000>IOException</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// If connect failed will throw a exception.
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>HugeClient</span> <span style=color:#000>hugeClient</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>builder</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;http://localhost:8080&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>build</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>SchemaManager</span> <span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDate</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knowsByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>GraphManager</span> <span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>graph</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>marko</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>29</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>vadas</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>27</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>lop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>328</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>josh</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>32</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>ripple</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>199</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>peter</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>LABEL</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>35</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2016-01-10&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>5</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2013-02-20&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>0</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2017-12-10&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>4</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2009-11-11&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>4</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2017-12-10&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>0</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2017-03-24&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>2</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>GremlinManager</span> <span style=color:#000>gremlin</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>gremlin</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;==== Path ====&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>ResultSet</span> <span style=color:#000>resultSet</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>gremlin</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;g.V().outE().path()&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>execute</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>Iterator</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>Result</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>results</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>resultSet</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>iterator</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>results</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>forEachRemaining</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>result</span> <span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>result</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getObject</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>getClass</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#000>Object</span> <span style=color:#000>object</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>result</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getObject</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>if</span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>object</span> <span style=color:#204a87;font-weight:700>instanceof</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(((</span><span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>object</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#204a87;font-weight:700>else</span> <span style=color:#204a87;font-weight:700>if</span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>object</span> <span style=color:#204a87;font-weight:700>instanceof</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(((</span><span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>object</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#204a87;font-weight:700>else</span> <span style=color:#204a87;font-weight:700>if</span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>object</span> <span style=color:#204a87;font-weight:700>instanceof</span> <span style=color:#000>Path</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>List</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>Object</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>elements</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#ce5c00;font-weight:700>((</span><span style=color:#000>Path</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>object</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>objects</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>elements</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>forEach</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>element</span> <span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>element</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getClass</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>element</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>});</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#204a87;font-weight:700>else</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>object</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>});</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>close</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=432-batchexample>4.3.2 BatchExample</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.ArrayList</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.List</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.GraphManager</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.HugeClient</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.driver.SchemaManager</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.graph.Edge</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.structure.graph.Vertex</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>BatchExample</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>[]</span> <span style=color:#000>args</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// If connect failed will throw a exception.
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>HugeClient</span> <span style=color:#000>hugeClient</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>builder</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;http://localhost:8080&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>build</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>SchemaManager</span> <span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDate</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>append</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// get schema object by name
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// list all schema objects
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKeys</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabels</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabels</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabels</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>GraphManager</span> <span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>graph</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>marko</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>29</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>vadas</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>27</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>lop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>328</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>josh</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>32</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>ripple</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>199</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>peter</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>35</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>markoKnowsVadas</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2016-01-10&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>markoKnowsJosh</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2013-02-20&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>markoCreateLop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2017-12-10&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>joshCreateRipple</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2017-12-10&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>joshCreateLop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;2009-11-11&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Edge</span> <span style=color:#000>peterCreateLop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>source</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>property</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2017-03-24&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>List</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>Vertex</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>vertices</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>ArrayList</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;();</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>List</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>Edge</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>edges</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>ArrayList</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;();</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>markoKnowsVadas</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>markoKnowsJosh</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>markoCreateLop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>joshCreateRipple</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>joshCreateLop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>add</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>peterCreateLop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertices</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>vertices</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>forEach</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>vertex</span> <span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdges</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>edges</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>forEach</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>edge</span> <span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>edge</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>close</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=44-运行-example>4.4 运行 Example</h3><p>运行 Example 之前需要启动 Server,
启动过程见<a href=/cn/docs/quickstart/hugegraph-server>HugeGraph-Server Quick Start</a></p><h3 id=45-详细-api-说明>4.5 详细 API 说明</h3><p>示例说明见<a href=/cn/docs/clients/hugegraph-client>HugeGraph-Client 基本 API 介绍</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-06d4cae527789fcda01ebf4e48c6559f>3.6 - HugeGraph-Tools Quick Start</h1><h3 id=1-hugegraph-tools概述>1 HugeGraph-Tools概述</h3><p>HugeGraph-Tools 是 HugeGraph 的自动化部署、管理和备份/还原组件。</p><h3 id=2-获取-hugegraph-tools>2 获取 HugeGraph-Tools</h3><p>有两种方式可以获取 HugeGraph-Tools:(它被包含子 Toolchain 中)</p><ul><li>下载二进制tar包</li><li>下载源码编译安装</li></ul><h4 id=21-下载二进制tar包>2.1 下载二进制tar包</h4><p>下载最新版本的 HugeGraph-Toolchain 包, 然后进入 tools 子目录</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0.tar.gz
</span></span><span style=display:flex><span>tar zxf *hugegraph*.tar.gz
</span></span></code></pre></div><h4 id=22-下载源码编译安装>2.2 下载源码编译安装</h4><p>源码编译前请确保安装了wget命令</p><p>下载最新版本的 HugeGraph-Toolchain 源码包, 然后根目录编译或者单独编译 tool 子模块:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 1. get from github</span>
</span></span><span style=display:flex><span>git clone https://github.com/apache/hugegraph-toolchain.git
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 2. get from direct (e.g. here is 1.0.0, please choose the latest version)</span>
</span></span><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/1.0.0/apache-hugegraph-toolchain-incubating-1.0.0-src.tar.gz
</span></span></code></pre></div><p>编译生成 tar 包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph-tools
</span></span><span style=display:flex><span>mvn package -DskipTests
</span></span></code></pre></div><p>生成 tar 包 hugegraph-tools-${version}.tar.gz</p><h3 id=3-使用>3 使用</h3><h4 id=31-功能概览>3.1 功能概览</h4><p>解压后,进入 hugegraph-tools 目录,可以使用<code>bin/hugegraph</code>或者<code>bin/hugegraph help</code>来查看 usage 信息。主要分为:</p><ul><li>图管理类,graph-mode-set、graph-mode-get、graph-list、graph-get 和 graph-clear</li><li>异步任务管理类,task-list、task-get、task-delete、task-cancel 和 task-clear</li><li>Gremlin类,gremlin-execute 和 gremlin-schedule</li><li>备份/恢复类,backup、restore、migrate、schedule-backup 和 dump</li><li>安装部署类,deploy、clear、start-all 和 stop-all</li></ul><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>Usage: hugegraph <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>command<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#204a87>command</span> options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span></code></pre></div><h5 id=32-options-全局变量>3.2 [options]-全局变量</h5><p><code>options</code>是 HugeGraph-Tools 的全局变量,可以在 hugegraph-tools/bin/hugegraph 中配置,包括:</p><ul><li>&ndash;graph,HugeGraph-Tools 操作的图的名字,默认值是 hugegraph</li><li>&ndash;url,HugeGraph-Server 的服务地址,默认是 http://127.0.0.1:8080</li><li>&ndash;user,当 HugeGraph-Server 开启认证时,传递用户名</li><li>&ndash;password,当 HugeGraph-Server 开启认证时,传递用户的密码</li><li>&ndash;timeout,连接 HugeGraph-Server 时的超时时间,默认是 30s</li><li>&ndash;trust-store-file,证书文件的路径,当 &ndash;url 使用 https 时,HugeGraph-Client 使用的 truststore 文件,默认为空,代表使用 hugegraph-tools 内置的 truststore 文件 conf/hugegraph.truststore</li><li>&ndash;trust-store-password,证书文件的密码,当 &ndash;url 使用 https 时,HugeGraph-Client 使用的 truststore 的密码,默认为空,代表使用 hugegraph-tools 内置的 truststore 文件的密码</li></ul><p>上述全局变量,也可以通过环境变量来设置。一种方式是在命令行使用 export 设置临时环境变量,在该命令行关闭之前均有效</p><table><thead><tr><th>全局变量</th><th>环境变量</th><th>示例</th></tr></thead><tbody><tr><td>&ndash;url</td><td>HUGEGRAPH_URL</td><td>export HUGEGRAPH_URL=http://127.0.0.1:8080</td></tr><tr><td>&ndash;graph</td><td>HUGEGRAPH_GRAPH</td><td>export HUGEGRAPH_GRAPH=hugegraph</td></tr><tr><td>&ndash;user</td><td>HUGEGRAPH_USERNAME</td><td>export HUGEGRAPH_USERNAME=admin</td></tr><tr><td>&ndash;password</td><td>HUGEGRAPH_PASSWORD</td><td>export HUGEGRAPH_PASSWORD=test</td></tr><tr><td>&ndash;timeout</td><td>HUGEGRAPH_TIMEOUT</td><td>export HUGEGRAPH_TIMEOUT=30</td></tr><tr><td>&ndash;trust-store-file</td><td>HUGEGRAPH_TRUST_STORE_FILE</td><td>export HUGEGRAPH_TRUST_STORE_FILE=/tmp/trust-store</td></tr><tr><td>&ndash;trust-store-password</td><td>HUGEGRAPH_TRUST_STORE_PASSWORD</td><td>export HUGEGRAPH_TRUST_STORE_PASSWORD=xxxx</td></tr></tbody></table><p>另一种方式是在 bin/hugegraph 脚本中设置环境变量:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#!/bin/bash
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Set environment here if needed</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_URL=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_GRAPH=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_USERNAME=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_PASSWORD=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_TIMEOUT=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_TRUST_STORE_FILE=</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#export HUGEGRAPH_TRUST_STORE_PASSWORD=</span>
</span></span></code></pre></div><h5 id=33-图管理类graph-mode-setgraph-mode-getgraph-listgraph-get和graph-clear>3.3 图管理类,graph-mode-set、graph-mode-get、graph-list、graph-get和graph-clear</h5><ul><li>graph-mode-set,设置图的 restore mode<ul><li>&ndash;graph-mode 或者 -m,必填项,指定将要设置的模式,合法值包括 [NONE, RESTORING, MERGING, LOADING]</li></ul></li><li>graph-mode-get,获取图的 restore mode</li><li>graph-list,列出某个 HugeGraph-Server 中全部的图</li><li>graph-get,获取某个图及其存储后端类型</li><li>graph-clear,清除某个图的全部 schema 和 data<ul><li>&ndash;confirm-message 或者 -c,必填项,删除确认信息,需要手动输入,二次确认防止误删,&ldquo;I&rsquo;m sure to delete all data&rdquo;,包括双引号</li></ul></li></ul><blockquote><p>当需要把备份的图原样恢复到一个新的图中的时候,需要先将图模式设置为 RESTORING 模式;当需要将备份的图合并到已存在的图中时,需要先将图模式设置为 MERGING 模式。</p></blockquote><h5 id=34-异步任务管理类task-listtask-get和task-delete>3.4 异步任务管理类,task-list、task-get和task-delete</h5><ul><li>task-list,列出某个图中的异步任务,可以根据任务的状态过滤<ul><li>&ndash;status,选填项,指定要查看的任务的状态,即按状态过滤任务</li><li>&ndash;limit,选填项,指定要获取的任务的数目,默认为 -1,意思为获取全部符合条件的任务</li></ul></li><li>task-get,获取某个异步任务的详细信息<ul><li>&ndash;task-id,必填项,指定异步任务的 ID</li></ul></li><li>task-delete,删除某个异步任务的信息<ul><li>&ndash;task-id,必填项,指定异步任务的 ID</li></ul></li><li>task-cancel,取消某个异步任务的执行<ul><li>&ndash;task-id,要取消的异步任务的 ID</li></ul></li><li>task-clear,清理完成的异步任务<ul><li>&ndash;force,选填项,设置时,表示清理全部异步任务,未执行完成的先取消,然后清除所有异步任务。默认只清理已完成的异步任务</li></ul></li></ul><h5 id=35-gremlin类gremlin-execute和gremlin-schedule>3.5 Gremlin类,gremlin-execute和gremlin-schedule</h5><ul><li>gremlin-execute,发送 Gremlin 语句到 HugeGraph-Server 来执行查询或修改操作,同步执行,结束后返回结果<ul><li>&ndash;file 或者 -f,指定要执行的脚本文件,UTF-8编码,与 &ndash;script 互斥</li><li>&ndash;script 或者 -s,指定要执行的脚本字符串,与 &ndash;file 互斥</li><li>&ndash;aliases 或者 -a,Gremlin 别名设置,格式为:key1=value1,key2=value2,&mldr;</li><li>&ndash;bindings 或者 -b,Gremlin 绑定设置,格式为:key1=value1,key2=value2,&mldr;</li><li>&ndash;language 或者 -l,Gremlin 脚本的语言,默认为 gremlin-groovy</li></ul><blockquote><p>&ndash;file 和 &ndash;script 二者互斥,必须设置其中之一</p></blockquote></li><li>gremlin-schedule,发送 Gremlin 语句到 HugeGraph-Server 来执行查询或修改操作,异步执行,任务提交后立刻返回异步任务id<ul><li>&ndash;file 或者 -f,指定要执行的脚本文件,UTF-8编码,与 &ndash;script 互斥</li><li>&ndash;script 或者 -s,指定要执行的脚本字符串,与 &ndash;file 互斥</li><li>&ndash;bindings 或者 -b,Gremlin 绑定设置,格式为:key1=value1,key2=value2,&mldr;</li><li>&ndash;language 或者 -l,Gremlin 脚本的语言,默认为 gremlin-groovy</li></ul><blockquote><p>&ndash;file 和 &ndash;script 二者互斥,必须设置其中之一</p></blockquote></li></ul><h5 id=36-备份恢复类>3.6 备份/恢复类</h5><ul><li>backup,将某张图中的 schema 或者 data 备份到 HugeGraph 系统之外,以 JSON 形式存在本地磁盘或者 HDFS<ul><li>&ndash;format,备份的格式,可选值包括 [json, text],默认为 json</li><li>&ndash;all-properties,是否备份顶点/边全部的属性,仅在 &ndash;format 为 text 是有效,默认 false</li><li>&ndash;label,要备份的顶点/边的类型,仅在 &ndash;format 为 text 是有效,只有备份顶点或者边的时候有效</li><li>&ndash;properties,要备份的顶点/边的属性,逗号分隔,仅在 &ndash;format 为 text 是有效,只有备份顶点或者边的时候有效</li><li>&ndash;compress,备份时是否压缩数据,默认为 true</li><li>&ndash;directory 或者 -d,存储 schema 或者 data 的目录,本地目录时,默认为&rsquo;./{graphName}&rsquo;,HDFS 时,默认为 &lsquo;{fs.default.name}/{graphName}&rsquo;</li><li>&ndash;huge-types 或者 -t,要备份的数据类型,逗号分隔,可选值为 &lsquo;all&rsquo; 或者 一个或多个 [vertex,edge,vertex_label,edge_label,property_key,index_label] 的组合,&lsquo;all&rsquo; 代表全部6种类型,即顶点、边和所有schema</li><li>&ndash;log 或者 -l,指定日志目录,默认为当前目录</li><li>&ndash;retry,指定失败重试次数,默认为 3</li><li>&ndash;split-size 或者 -s,指定在备份时对顶点或者边分块的大小,默认为 1048576</li><li>-D,用 -Dkey=value 的模式指定动态参数,用来备份数据到 HDFS 时,指定 HDFS 的配置项,例如:-Dfs.default.name=hdfs://localhost:9000</li></ul></li><li>restore,将 JSON 格式存储的 schema 或者 data 恢复到一个新图中(RESTORING 模式)或者合并到已存在的图中(MERGING 模式)<ul><li>&ndash;directory 或者 -d,存储 schema 或者 data 的目录,本地目录时,默认为&rsquo;./{graphName}&rsquo;,HDFS 时,默认为 &lsquo;{fs.default.name}/{graphName}&rsquo;</li><li>&ndash;clean,是否在恢复图完成后删除 &ndash;directory 指定的目录,默认为 false</li><li>&ndash;huge-types 或者 -t,要恢复的数据类型,逗号分隔,可选值为 &lsquo;all&rsquo; 或者 一个或多个 [vertex,edge,vertex_label,edge_label,property_key,index_label] 的组合,&lsquo;all&rsquo; 代表全部6种类型,即顶点、边和所有schema</li><li>&ndash;log 或者 -l,指定日志目录,默认为当前目录</li><li>&ndash;retry,指定失败重试次数,默认为 3</li><li>-D,用 -Dkey=value 的模式指定动态参数,用来从 HDFS 恢复图时,指定 HDFS 的配置项,例如:-Dfs.default.name=hdfs://localhost:9000</li></ul><blockquote><p>只有当 &ndash;format 为 json 执行 backup 时,才可以使用 restore 命令恢复</p></blockquote></li><li>migrate, 将当前连接的图迁移至另一个 HugeGraphServer 中<ul><li>&ndash;target-graph,目标图的名字,默认为 hugegraph</li><li>&ndash;target-url,目标图所在的 HugeGraphServer,默认为 http://127.0.0.1:8081</li><li>&ndash;target-username,访问目标图的用户名</li><li>&ndash;target-password,访问目标图的密码</li><li>&ndash;target-timeout,访问目标图的超时时间</li><li>&ndash;target-trust-store-file,访问目标图使用的 truststore 文件</li><li>&ndash;target-trust-store-password,访问目标图使用的 truststore 的密码</li><li>&ndash;directory 或者 -d,迁移过程中,存储源图的 schema 或者 data 的目录,本地目录时,默认为&rsquo;./{graphName}&rsquo;,HDFS 时,默认为 &lsquo;{fs.default.name}/{graphName}&rsquo;</li><li>&ndash;huge-types 或者 -t,要迁移的数据类型,逗号分隔,可选值为 &lsquo;all&rsquo; 或者 一个或多个 [vertex,edge,vertex_label,edge_label,property_key,index_label] 的组合,&lsquo;all&rsquo; 代表全部6种类型,即顶点、边和所有schema</li><li>&ndash;log 或者 -l,指定日志目录,默认为当前目录</li><li>&ndash;retry,指定失败重试次数,默认为 3</li><li>&ndash;split-size 或者 -s,指定迁移过程中对源图进行备份时顶点或者边分块的大小,默认为 1048576</li><li>-D,用 -Dkey=value 的模式指定动态参数,用来在迁移图过程中需要备份数据到 HDFS 时,指定 HDFS 的配置项,例如:-Dfs.default.name=hdfs://localhost:9000</li><li>&ndash;graph-mode 或者 -m,将源图恢复到目标图时将目标图设置的模式,合法值包括 [RESTORING, MERGING]</li><li>&ndash;keep-local-data,是否保留在迁移图的过程中产生的源图的备份,默认为 false,即默认迁移图结束后不保留产生的源图备份</li></ul></li><li>schedule-backup,周期性对图执行备份操作,并保留一定数目的最新备份(目前仅支持本地文件系统)<ul><li>&ndash;directory 或者 -d,必填项,指定备份数据的目录</li><li>&ndash;backup-num,选填项,指定保存的最新的备份的数目,默认为 3</li><li>&ndash;interval,选填项,指定进行备份的周期,格式同 Linux crontab 格式</li></ul></li><li>dump,把整张图的顶点和边全部导出,默认以<code>vertex vertex-edge1 vertex-edge2...</code>JSON格式存储。
用户也可以自定义存储格式,只需要在<code>hugegraph-tools/src/main/java/com/baidu/hugegraph/formatter</code>
目录下实现一个继承自<code>Formatter</code>的类,例如<code>CustomFormatter</code>,使用时指定该类为formatter即可,例如
<code>bin/hugegraph dump -f CustomFormatter</code><ul><li>&ndash;formatter 或者 -f,指定使用的 formatter,默认为 JsonFormatter</li><li>&ndash;directory 或者 -d,存储 schema 或者 data 的目录,默认为当前目录</li><li>&ndash;log 或者 -l,指定日志目录,默认为当前目录</li><li>&ndash;retry,指定失败重试次数,默认为 3</li><li>&ndash;split-size 或者 -s,指定在备份时对顶点或者边分块的大小,默认为 1048576</li><li>-D,用 -Dkey=value 的模式指定动态参数,用来备份数据到 HDFS 时,指定 HDFS 的配置项,例如:-Dfs.default.name=hdfs://localhost:9000</li></ul></li></ul><h5 id=37-安装部署类>3.7 安装部署类</h5><ul><li>deploy,一键下载、安装和启动 HugeGraph-Server 和 HugeGraph-Studio<ul><li>-v,必填项,指明安装的 HugeGraph-Server 和 HugeGraph-Studio 的版本号,最新的是 0.9</li><li>-p,必填项,指定安装的 HugeGraph-Server 和 HugeGraph-Studio 目录</li><li>-u,选填项,指定下载 HugeGraph-Server 和 HugeGraph-Studio 压缩包的链接</li></ul></li><li>clear,清理 HugeGraph-Server 和 HugeGraph-Studio 目录和tar包<ul><li>-p,必填项,指定要清理的 HugeGraph-Server 和 HugeGraph-Studio 的目录</li></ul></li><li>start-all,一键启动 HugeGraph-Server 和 HugeGraph-Studio,并启动监控,服务死掉时自动拉起服务<ul><li>-v,必填项,指明要启动的 HugeGraph-Server 和 HugeGraph-Studio 的版本号,最新的是 0.9</li><li>-p,必填项,指定安装了 HugeGraph-Server 和 HugeGraph-Studio 的目录</li></ul></li><li>stop-all,一键关闭 HugeGraph-Server 和 HugeGraph-Studio</li></ul><blockquote><p>deploy命令中有可选参数 -u,提供时会使用指定的下载地址替代默认下载地址下载 tar 包,并且将地址写入<code>~/hugegraph-download-url-prefix</code>文件中;之后如果不指定地址时,会优先从<code>~/hugegraph-download-url-prefix</code>指定的地址下载 tar 包;如果 -u 和<code>~/hugegraph-download-url-prefix</code>都没有时,会从默认下载地址进行下载</p></blockquote><h5 id=38-具体命令参数>3.8 具体命令参数</h5><p>各子命令的具体参数如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>Usage: hugegraph <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>command<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#204a87>command</span> options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --graph
</span></span><span style=display:flex><span> Name of graph
</span></span><span style=display:flex><span> Default: hugegraph
</span></span><span style=display:flex><span> --password
</span></span><span style=display:flex><span> Password of user
</span></span><span style=display:flex><span> --timeout
</span></span><span style=display:flex><span> Connection timeout
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> --trust-store-file
</span></span><span style=display:flex><span> The path of client truststore file used when https protocol is enabled
</span></span><span style=display:flex><span> --trust-store-password
</span></span><span style=display:flex><span> The password of the client truststore file used when the https protocol
</span></span><span style=display:flex><span> is enabled
</span></span><span style=display:flex><span> --url
</span></span><span style=display:flex><span> The URL of HugeGraph-Server
</span></span><span style=display:flex><span> Default: http://127.0.0.1:8080
</span></span><span style=display:flex><span> --user
</span></span><span style=display:flex><span> Name of user
</span></span><span style=display:flex><span> Commands:
</span></span><span style=display:flex><span> graph-list List all graphs
</span></span><span style=display:flex><span> Usage: graph-list
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> graph-get Get graph info
</span></span><span style=display:flex><span> Usage: graph-get
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> graph-clear Clear graph schema and data
</span></span><span style=display:flex><span> Usage: graph-clear <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * --confirm-message, -c
</span></span><span style=display:flex><span> Confirm message of graph clear is <span style=color:#4e9a06>&#34;I&#39;m sure to delete all data&#34;</span>.
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>(</span>Note: include <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> graph-mode-set Set graph mode
</span></span><span style=display:flex><span> Usage: graph-mode-set <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * --graph-mode, -m
</span></span><span style=display:flex><span> Graph mode, include: <span style=color:#ce5c00;font-weight:700>[</span>NONE, RESTORING, MERGING<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Possible Values: <span style=color:#ce5c00;font-weight:700>[</span>NONE, RESTORING, MERGING, LOADING<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> graph-mode-get Get graph mode
</span></span><span style=display:flex><span> Usage: graph-mode-get
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> task-list List tasks
</span></span><span style=display:flex><span> Usage: task-list <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --limit
</span></span><span style=display:flex><span> Limit number, no limit <span style=color:#204a87;font-weight:700>if</span> not provided
</span></span><span style=display:flex><span> Default: -1
</span></span><span style=display:flex><span> --status
</span></span><span style=display:flex><span> Status of task
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> task-get Get task info
</span></span><span style=display:flex><span> Usage: task-get <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * --task-id
</span></span><span style=display:flex><span> Task id
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> task-delete Delete task
</span></span><span style=display:flex><span> Usage: task-delete <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * --task-id
</span></span><span style=display:flex><span> Task id
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> task-cancel Cancel task
</span></span><span style=display:flex><span> Usage: task-cancel <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * --task-id
</span></span><span style=display:flex><span> Task id
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> task-clear Clear completed tasks
</span></span><span style=display:flex><span> Usage: task-clear <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --force
</span></span><span style=display:flex><span> Force to clear all tasks, cancel all uncompleted tasks firstly,
</span></span><span style=display:flex><span> and delete all completed tasks
</span></span><span style=display:flex><span> Default: <span style=color:#204a87>false</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> gremlin-execute Execute Gremlin statements
</span></span><span style=display:flex><span> Usage: gremlin-execute <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --aliases, -a
</span></span><span style=display:flex><span> Gremlin aliases, valid format is: <span style=color:#4e9a06>&#39;key1=value1,key2=value2...&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span> --bindings, -b
</span></span><span style=display:flex><span> Gremlin bindings, valid format is: <span style=color:#4e9a06>&#39;key1=value1,key2=value2...&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span> --file, -f
</span></span><span style=display:flex><span> Gremlin Script file to be executed, UTF-8 encoded, exclusive to
</span></span><span style=display:flex><span> --script
</span></span><span style=display:flex><span> --language, -l
</span></span><span style=display:flex><span> Gremlin script language
</span></span><span style=display:flex><span> Default: gremlin-groovy
</span></span><span style=display:flex><span> --script, -s
</span></span><span style=display:flex><span> Gremlin script to be executed, exclusive to --file
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> gremlin-schedule Execute Gremlin statements as asynchronous job
</span></span><span style=display:flex><span> Usage: gremlin-schedule <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --bindings, -b
</span></span><span style=display:flex><span> Gremlin bindings, valid format is: <span style=color:#4e9a06>&#39;key1=value1,key2=value2...&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span> --file, -f
</span></span><span style=display:flex><span> Gremlin Script file to be executed, UTF-8 encoded, exclusive to
</span></span><span style=display:flex><span> --script
</span></span><span style=display:flex><span> --language, -l
</span></span><span style=display:flex><span> Gremlin script language
</span></span><span style=display:flex><span> Default: gremlin-groovy
</span></span><span style=display:flex><span> --script, -s
</span></span><span style=display:flex><span> Gremlin script to be executed, exclusive to --file
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> backup Backup graph schema/data. If directory is on HDFS, use -D to
</span></span><span style=display:flex><span> <span style=color:#204a87>set</span> HDFS params. For exmaple:
</span></span><span style=display:flex><span> -Dfs.default.name<span style=color:#ce5c00;font-weight:700>=</span>hdfs://localhost:9000
</span></span><span style=display:flex><span> Usage: backup <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --all-properties
</span></span><span style=display:flex><span> All properties to be backup flag
</span></span><span style=display:flex><span> Default: <span style=color:#204a87>false</span>
</span></span><span style=display:flex><span> --compress
</span></span><span style=display:flex><span> compress flag
</span></span><span style=display:flex><span> Default: <span style=color:#204a87>true</span>
</span></span><span style=display:flex><span> --directory, -d
</span></span><span style=display:flex><span> Directory of graph schema/data, default is <span style=color:#4e9a06>&#39;./{graphname}&#39;</span> in
</span></span><span style=display:flex><span> <span style=color:#204a87>local</span> file system or <span style=color:#4e9a06>&#39;{fs.default.name}/{graphname}&#39;</span> in HDFS
</span></span><span style=display:flex><span> --format
</span></span><span style=display:flex><span> File format, valid is <span style=color:#ce5c00;font-weight:700>[</span>json, text<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Default: json
</span></span><span style=display:flex><span> --huge-types, -t
</span></span><span style=display:flex><span> Type of schema/data. Concat with <span style=color:#4e9a06>&#39;,&#39;</span> <span style=color:#204a87;font-weight:700>if</span> more than one. <span style=color:#4e9a06>&#39;all&#39;</span> means
</span></span><span style=display:flex><span> all vertices, edges and schema, in other words, <span style=color:#4e9a06>&#39;all&#39;</span> equals with
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#39;vertex,edge,vertex_label,edge_label,property_key,index_label&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>[</span>PROPERTY_KEY, VERTEX_LABEL, EDGE_LABEL, INDEX_LABEL, VERTEX, EDGE<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> --label
</span></span><span style=display:flex><span> Vertex or edge label, only valid when <span style=color:#204a87>type</span> is vertex or edge
</span></span><span style=display:flex><span> --log, -l
</span></span><span style=display:flex><span> Directory of log
</span></span><span style=display:flex><span> Default: ./logs
</span></span><span style=display:flex><span> --properties
</span></span><span style=display:flex><span> Vertex or edge properties to backup, only valid when <span style=color:#204a87>type</span> is
</span></span><span style=display:flex><span> vertex or edge
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>[]</span>
</span></span><span style=display:flex><span> --retry
</span></span><span style=display:flex><span> Retry times, default is <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> --split-size, -s
</span></span><span style=display:flex><span> Split size of shard
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>1048576</span>
</span></span><span style=display:flex><span> -D
</span></span><span style=display:flex><span> HDFS config parameters
</span></span><span style=display:flex><span> Syntax: -Dkey<span style=color:#ce5c00;font-weight:700>=</span>value
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> schedule-backup Schedule backup task
</span></span><span style=display:flex><span> Usage: schedule-backup <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --backup-num
</span></span><span style=display:flex><span> The number of latest backups to keep
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> * --directory, -d
</span></span><span style=display:flex><span> The directory of backups stored
</span></span><span style=display:flex><span> --interval
</span></span><span style=display:flex><span> The interval of backup, format is: <span style=color:#4e9a06>&#34;a b c d e&#34;</span>. <span style=color:#4e9a06>&#39;a&#39;</span> means minute
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>0</span> - 59<span style=color:#ce5c00;font-weight:700>)</span>, <span style=color:#4e9a06>&#39;b&#39;</span> means hour <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>0</span> - 23<span style=color:#ce5c00;font-weight:700>)</span>, <span style=color:#4e9a06>&#39;c&#39;</span> means day of month <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>1</span> -
</span></span><span style=display:flex><span> 31<span style=color:#ce5c00;font-weight:700>)</span>, <span style=color:#4e9a06>&#39;d&#39;</span> means month <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>1</span> - 12<span style=color:#ce5c00;font-weight:700>)</span>, <span style=color:#4e9a06>&#39;e&#39;</span> means day of week <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>0</span> - 6<span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>Sunday</span><span style=color:#ce5c00;font-weight:700>=</span>0<span style=color:#ce5c00;font-weight:700>)</span>, <span style=color:#4e9a06>&#34;*&#34;</span> means all
</span></span><span style=display:flex><span> Default: <span style=color:#4e9a06>&#34;0 0 * * *&#34;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> dump Dump graph to files
</span></span><span style=display:flex><span> Usage: dump <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --directory, -d
</span></span><span style=display:flex><span> Directory of graph schema/data, default is <span style=color:#4e9a06>&#39;./{graphname}&#39;</span> in
</span></span><span style=display:flex><span> <span style=color:#204a87>local</span> file system or <span style=color:#4e9a06>&#39;{fs.default.name}/{graphname}&#39;</span> in HDFS
</span></span><span style=display:flex><span> --formatter, -f
</span></span><span style=display:flex><span> Formatter to customize format of vertex/edge
</span></span><span style=display:flex><span> Default: JsonFormatter
</span></span><span style=display:flex><span> --log, -l
</span></span><span style=display:flex><span> Directory of log
</span></span><span style=display:flex><span> Default: ./logs
</span></span><span style=display:flex><span> --retry
</span></span><span style=display:flex><span> Retry times, default is <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> --split-size, -s
</span></span><span style=display:flex><span> Split size of shard
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>1048576</span>
</span></span><span style=display:flex><span> -D
</span></span><span style=display:flex><span> HDFS config parameters
</span></span><span style=display:flex><span> Syntax: -Dkey<span style=color:#ce5c00;font-weight:700>=</span>value
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> restore Restore graph schema/data. If directory is on HDFS, use -D to
</span></span><span style=display:flex><span> <span style=color:#204a87>set</span> HDFS params <span style=color:#204a87;font-weight:700>if</span> needed. For
</span></span><span style=display:flex><span> exmaple:-Dfs.default.name<span style=color:#ce5c00;font-weight:700>=</span>hdfs://localhost:9000
</span></span><span style=display:flex><span> Usage: restore <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --clean
</span></span><span style=display:flex><span> Whether to remove the directory of graph data after restored
</span></span><span style=display:flex><span> Default: <span style=color:#204a87>false</span>
</span></span><span style=display:flex><span> --directory, -d
</span></span><span style=display:flex><span> Directory of graph schema/data, default is <span style=color:#4e9a06>&#39;./{graphname}&#39;</span> in
</span></span><span style=display:flex><span> <span style=color:#204a87>local</span> file system or <span style=color:#4e9a06>&#39;{fs.default.name}/{graphname}&#39;</span> in HDFS
</span></span><span style=display:flex><span> --huge-types, -t
</span></span><span style=display:flex><span> Type of schema/data. Concat with <span style=color:#4e9a06>&#39;,&#39;</span> <span style=color:#204a87;font-weight:700>if</span> more than one. <span style=color:#4e9a06>&#39;all&#39;</span> means
</span></span><span style=display:flex><span> all vertices, edges and schema, in other words, <span style=color:#4e9a06>&#39;all&#39;</span> equals with
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#39;vertex,edge,vertex_label,edge_label,property_key,index_label&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>[</span>PROPERTY_KEY, VERTEX_LABEL, EDGE_LABEL, INDEX_LABEL, VERTEX, EDGE<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> --log, -l
</span></span><span style=display:flex><span> Directory of log
</span></span><span style=display:flex><span> Default: ./logs
</span></span><span style=display:flex><span> --retry
</span></span><span style=display:flex><span> Retry times, default is <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> -D
</span></span><span style=display:flex><span> HDFS config parameters
</span></span><span style=display:flex><span> Syntax: -Dkey<span style=color:#ce5c00;font-weight:700>=</span>value
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> migrate Migrate graph
</span></span><span style=display:flex><span> Usage: migrate <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> --directory, -d
</span></span><span style=display:flex><span> Directory of graph schema/data, default is <span style=color:#4e9a06>&#39;./{graphname}&#39;</span> in
</span></span><span style=display:flex><span> <span style=color:#204a87>local</span> file system or <span style=color:#4e9a06>&#39;{fs.default.name}/{graphname}&#39;</span> in HDFS
</span></span><span style=display:flex><span> --graph-mode, -m
</span></span><span style=display:flex><span> Mode used when migrating to target graph, include: <span style=color:#ce5c00;font-weight:700>[</span>RESTORING,
</span></span><span style=display:flex><span> MERGING<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Default: RESTORING
</span></span><span style=display:flex><span> Possible Values: <span style=color:#ce5c00;font-weight:700>[</span>NONE, RESTORING, MERGING, LOADING<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> --huge-types, -t
</span></span><span style=display:flex><span> Type of schema/data. Concat with <span style=color:#4e9a06>&#39;,&#39;</span> <span style=color:#204a87;font-weight:700>if</span> more than one. <span style=color:#4e9a06>&#39;all&#39;</span> means
</span></span><span style=display:flex><span> all vertices, edges and schema, in other words, <span style=color:#4e9a06>&#39;all&#39;</span> equals with
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#39;vertex,edge,vertex_label,edge_label,property_key,index_label&#39;</span>
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>[</span>PROPERTY_KEY, VERTEX_LABEL, EDGE_LABEL, INDEX_LABEL, VERTEX, EDGE<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> --keep-local-data
</span></span><span style=display:flex><span> Whether to keep the <span style=color:#204a87>local</span> directory of graph data after restored
</span></span><span style=display:flex><span> Default: <span style=color:#204a87>false</span>
</span></span><span style=display:flex><span> --log, -l
</span></span><span style=display:flex><span> Directory of log
</span></span><span style=display:flex><span> Default: ./logs
</span></span><span style=display:flex><span> --retry
</span></span><span style=display:flex><span> Retry times, default is <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span> --split-size, -s
</span></span><span style=display:flex><span> Split size of shard
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>1048576</span>
</span></span><span style=display:flex><span> --target-graph
</span></span><span style=display:flex><span> The name of target graph to migrate
</span></span><span style=display:flex><span> Default: hugegraph
</span></span><span style=display:flex><span> --target-password
</span></span><span style=display:flex><span> The password of target graph to migrate
</span></span><span style=display:flex><span> --target-timeout
</span></span><span style=display:flex><span> The timeout to connect target graph to migrate
</span></span><span style=display:flex><span> Default: <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> --target-trust-store-file
</span></span><span style=display:flex><span> The trust store file of target graph to migrate
</span></span><span style=display:flex><span> --target-trust-store-password
</span></span><span style=display:flex><span> The trust store password of target graph to migrate
</span></span><span style=display:flex><span> --target-url
</span></span><span style=display:flex><span> The url of target graph to migrate
</span></span><span style=display:flex><span> Default: http://127.0.0.1:8081
</span></span><span style=display:flex><span> --target-user
</span></span><span style=display:flex><span> The username of target graph to migrate
</span></span><span style=display:flex><span> -D
</span></span><span style=display:flex><span> HDFS config parameters
</span></span><span style=display:flex><span> Syntax: -Dkey<span style=color:#ce5c00;font-weight:700>=</span>value
</span></span><span style=display:flex><span> Default: <span style=color:#ce5c00;font-weight:700>{}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> deploy Install HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> Usage: deploy <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * -p
</span></span><span style=display:flex><span> Install path of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> -u
</span></span><span style=display:flex><span> Download url prefix path of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> * -v
</span></span><span style=display:flex><span> Version of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> start-all Start HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> Usage: start-all <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * -p
</span></span><span style=display:flex><span> Install path of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> * -v
</span></span><span style=display:flex><span> Version of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> clear Clear HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> Usage: clear <span style=color:#ce5c00;font-weight:700>[</span>options<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span> Options:
</span></span><span style=display:flex><span> * -p
</span></span><span style=display:flex><span> Install path of HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> stop-all Stop HugeGraph-Server and HugeGraph-Studio
</span></span><span style=display:flex><span> Usage: stop-all
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87>help</span> Print usage
</span></span><span style=display:flex><span> Usage: <span style=color:#204a87>help</span>
</span></span></code></pre></div><h5 id=39-具体命令示例>3.9 具体命令示例</h5><h6 id=1-gremlin语句>1. gremlin语句</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 同步执行gremlin</span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph gremlin-execute --script <span style=color:#4e9a06>&#39;g.V().count()&#39;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 异步执行gremlin</span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph gremlin-schedule --script <span style=color:#4e9a06>&#39;g.V().count()&#39;</span>
</span></span></code></pre></div><h6 id=2-查看task情况>2. 查看task情况</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph task-list
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph task-list --limit <span style=color:#0000cf;font-weight:700>5</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph task-list --status success
</span></span></code></pre></div><h6 id=3-图模式查看和设置>3. 图模式查看和设置</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-mode-set -m RESTORING MERGING NONE
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-mode-set -m RESTORING
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-mode-get
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-list
</span></span></code></pre></div><h6 id=4-清理图>4. 清理图</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-clear -c <span style=color:#4e9a06>&#34;I&#39;m sure to delete all data&#34;</span>
</span></span></code></pre></div><h6 id=5-图备份>5. 图备份</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph backup -t all --directory ./backup-test
</span></span></code></pre></div><h6 id=6-周期性的备份>6. 周期性的备份</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph --interval */2 * * * * schedule-backup -d ./backup-0.10.2
</span></span></code></pre></div><h6 id=7-图恢复>7. 图恢复</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 设置图模式</span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-mode-set -m RESTORING
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 恢复图</span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph restore -t all --directory ./backup-test
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 恢复图模式</span>
</span></span><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph graph-mode-set -m NONE
</span></span></code></pre></div><h6 id=8-图迁移>8. 图迁移</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>./bin/hugegraph --url http://127.0.0.1:8080 --graph hugegraph migrate --target-url http://127.0.0.1:8090 --target-graph hugegraph
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-e68a801476ae8ef5e45c79949a3a5e44>3.7 - HugeGraph-Computer Quick Start</h1><h2 id=1-hugegraph-computer-概述>1 HugeGraph-Computer 概述</h2><p><a href=https://github.com/apache/incubator-hugegraph-computer><code>HugeGraph-Computer</code></a> 是分布式图处理系统 (OLAP). 它是 <a href=https://kowshik.github.io/JPregel/pregel_paper.pdf>Pregel</a> 的一个实现. 它可以运行在 Kubernetes 上。</p><h3 id=特性>特性</h3><ul><li>支持分布式MPP图计算,集成HugeGraph作为图输入输出存储。</li><li>算法基于BSP(Bulk Synchronous Parallel)模型,通过多次并行迭代进行计算,每一次迭代都是一次超步。</li><li>自动内存管理。该框架永远不会出现 OOM(内存不足),因为如果它没有足够的内存来容纳所有数据,它会将一些数据拆分到磁盘。</li><li>边的部分或超级节点的消息可以在内存中,所以你永远不会丢失它。</li><li>您可以从 HDFS 或 HugeGraph 或任何其他系统加载数据。</li><li>您可以将结果输出到 HDFS 或 HugeGraph,或任何其他系统。</li><li>易于开发新算法。您只需要像在单个服务器中一样专注于仅顶点处理,而不必担心消息传输和内存存储管理。</li></ul><h2 id=2-依赖>2 依赖</h2><h3 id=21-安装-java-11-jdk-11>2.1 安装 Java 11 (JDK 11)</h3><p><strong>必须</strong>在 ≥ <code>Java 11</code> 的环境上启动 <code>Computer</code>,然后自行配置。</p><p><strong>在往下阅读之前务必执行 <code>java -version</code> 命令查看 jdk 版本</strong></p><h2 id=3-开始>3 开始</h2><h3 id=31-在本地运行-pagerank-算法>3.1 在本地运行 PageRank 算法</h3><blockquote><p>要使用 HugeGraph-Computer 运行算法,必须装有 Java 11 或更高版本。</p><p>还需要首先部署 HugeGraph-Server 和 <a href=https://etcd.io/docs/v3.5/quickstart/>Etcd</a>.</p></blockquote><p>有两种方式可以获取 HugeGraph-Computer:</p><ul><li>下载已编译的压缩包</li><li>克隆源码编译打包</li></ul><h4 id=311-下载已编译的压缩包>3.1.1 下载已编译的压缩包</h4><p>下载最新版本的 HugeGraph-Computer release 包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>wget https://downloads.apache.org/incubator/hugegraph/<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>/apache-hugegraph-computer-incubating-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>.tar.gz
</span></span><span style=display:flex><span>tar zxvf apache-hugegraph-computer-incubating-<span style=color:#4e9a06>${</span><span style=color:#000>version</span><span style=color:#4e9a06>}</span>.tar.gz -C hugegraph-computer
</span></span></code></pre></div><h4 id=312-克隆源码编译打包>3.1.2 克隆源码编译打包</h4><p>克隆最新版本的 HugeGraph-Computer 源码包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>$ git clone https://github.com/apache/hugegraph-computer.git
</span></span></code></pre></div><p>编译生成tar包:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph-computer
</span></span><span style=display:flex><span>mvn clean package -DskipTests
</span></span></code></pre></div><h4 id=313-启动-master-节点>3.1.3 启动 master 节点</h4><blockquote><p>您可以使用 <code>-c</code> 参数指定配置文件, 更多computer 配置请看: <a href=/docs/config/config-computer#computer-config-options>Computer Config Options</a></p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph-computer
</span></span><span style=display:flex><span>bin/start-computer.sh -d <span style=color:#204a87>local</span> -r master
</span></span></code></pre></div><h4 id=314-启动-worker-节点>3.1.4 启动 worker 节点</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/start-computer.sh -d <span style=color:#204a87>local</span> -r worker
</span></span></code></pre></div><h4 id=315-查询算法结果>3.1.5 查询算法结果</h4><p>2.5.1 为 server 启用 <code>OLAP</code> 索引查询</p><p>如果没有启用OLAP索引,则需要启用, 更多参考: <a href=/docs/clients/restful-api/graphs/#634-modify-graphs-read-mode-this-operation-requires-administrator-privileges>modify-graphs-read-mode</a></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-http data-lang=http><span style=display:flex><span><span style=color:#a40000>PUT http://localhost:8080/graphs/hugegraph/graph_read_mode
</span></span></span><span style=display:flex><span><span style=color:#a40000>
</span></span></span><span style=display:flex><span><span style=color:#a40000>&#34;ALL&#34;
</span></span></span></code></pre></div><p>3.1.5.2 查询 <code>page_rank</code> 属性值:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices?page&amp;limit=3&#34;</span> <span style=color:#000;font-weight:700>|</span> gunzip
</span></span></code></pre></div><h3 id=32-在-kubernetes-中运行-pagerank-算法>3.2 在 Kubernetes 中运行 PageRank 算法</h3><blockquote><p>要使用 HugeGraph-Computer 运行算法,您需要先部署 HugeGraph-Server</p></blockquote><h4 id=321-安装-hugegraph-computer-crd>3.2.1 安装 HugeGraph-Computer CRD</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Kubernetes version &gt;= v1.16</span>
</span></span><span style=display:flex><span>kubectl apply -f https://raw.githubusercontent.com/apache/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1.yaml
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Kubernetes version &lt; v1.16</span>
</span></span><span style=display:flex><span>kubectl apply -f https://raw.githubusercontent.com/apache/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1beta1.yaml
</span></span></code></pre></div><h4 id=322-显示-crd>3.2.2 显示 CRD</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl get crd
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>NAME CREATED AT
</span></span><span style=display:flex><span>hugegraphcomputerjobs.hugegraph.apache.org 2021-09-16T08:01:08Z
</span></span></code></pre></div><h4 id=323-安装-hugegraph-computer-operatoretcd-server>3.2.3 安装 hugegraph-computer-operator&etcd-server</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl apply -f https://raw.githubusercontent.com/apache/hugegraph-computer/master/computer-k8s-operator/manifest/hugegraph-computer-operator.yaml
</span></span></code></pre></div><h4 id=324-等待-hugegraph-computer-operatoretcd-server-部署完成>3.2.4 等待 hugegraph-computer-operator&etcd-server 部署完成</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl get pod -n hugegraph-computer-operator-system
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>NAME READY STATUS RESTARTS AGE
</span></span><span style=display:flex><span>hugegraph-computer-operator-controller-manager-58c5545949-jqvzl 1/1 Running <span style=color:#0000cf;font-weight:700>0</span> 15h
</span></span><span style=display:flex><span>hugegraph-computer-operator-etcd-28lm67jxk5 1/1 Running <span style=color:#0000cf;font-weight:700>0</span> 15h
</span></span></code></pre></div><h4 id=325-提交作业>3.2.5 提交作业</h4><blockquote><p>更多 computer crd spec 请看: <a href=/docs/config/config-computer#hugegraph-computer-crd>Computer CRD</a></p><p>更多 Computer 配置请看: <a href=/docs/config/config-computer#computer-config-options>Computer Config Options</a></p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#000>cat &lt;&lt;EOF | kubectl apply --filename -</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>apiVersion</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph.apache.org/v1</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>kind</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>HugeGraphComputerJob</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>metadata</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>namespace</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph-computer-operator-system</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic>&amp;jobName</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>pagerank-sample</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>spec</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>jobId</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic>*jobName</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>algorithmName</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>page_rank</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph-computer:latest</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># algorithm image url</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>jarFile</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>/hugegraph/hugegraph-computer/algorithm/builtin-algorithm.jar</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># algorithm jar path</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>pullPolicy</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>Always</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>workerCpu</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;4&#34;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>workerMemory</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;4Gi&#34;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>workerInstances</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>5</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>computerConf</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>job.partitions_count</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#34;20&#34;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>algorithm.params_class</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.computer.algorithm.centrality.pagerank.PageRankParams</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.url</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>http://${hugegraph-server-host}:${hugegraph-server-port}</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># hugegraph server url</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>hugegraph.name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#8f5902;font-style:italic># hugegraph graph name</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#000>EOF</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><h4 id=326-显示作业>3.2.6 显示作业</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl get hcjob/pagerank-sample -n hugegraph-computer-operator-system
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>NAME JOBID JOBSTATUS
</span></span><span style=display:flex><span>pagerank-sample pagerank-sample RUNNING
</span></span></code></pre></div><h4 id=327-显示节点日志>3.2.7 显示节点日志</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Show the master log</span>
</span></span><span style=display:flex><span>kubectl logs -l <span style=color:#000>component</span><span style=color:#ce5c00;font-weight:700>=</span>pagerank-sample-master -n hugegraph-computer-operator-system
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Show the worker log</span>
</span></span><span style=display:flex><span>kubectl logs -l <span style=color:#000>component</span><span style=color:#ce5c00;font-weight:700>=</span>pagerank-sample-worker -n hugegraph-computer-operator-system
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Show diagnostic log of a job</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 注意: 诊断日志仅在作业失败时存在,并且只会保存一小时。</span>
</span></span><span style=display:flex><span>kubectl get event --field-selector <span style=color:#000>reason</span><span style=color:#ce5c00;font-weight:700>=</span>ComputerJobFailed --field-selector involvedObject.name<span style=color:#ce5c00;font-weight:700>=</span>pagerank-sample -n hugegraph-computer-operator-system
</span></span></code></pre></div><h4 id=328-显示作业的成功事件>3.2.8 显示作业的成功事件</h4><blockquote><p>NOTE: it will only be saved for one hour</p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl get event --field-selector <span style=color:#000>reason</span><span style=color:#ce5c00;font-weight:700>=</span>ComputerJobSucceed --field-selector involvedObject.name<span style=color:#ce5c00;font-weight:700>=</span>pagerank-sample -n hugegraph-computer-operator-system
</span></span></code></pre></div><h4 id=329-查询算法结果>3.2.9 查询算法结果</h4><p>如果输出到 <code>Hugegraph-Server</code> 则与 Locally 模式一致,如果输出到 <code>HDFS</code> ,请检查 <code>hugegraph-computerresults{jobId}</code>目录下的结果文件。</p><h2 id=4-内置算法文档>4 内置算法文档</h2><h3 id=41-支持的算法列表>4.1 支持的算法列表:</h3><h6 id=中心性算法>中心性算法:</h6><ul><li>PageRank</li><li>BetweennessCentrality</li><li>ClosenessCentrality</li><li>DegreeCentrality</li></ul><h6 id=社区算法>社区算法:</h6><ul><li>ClusteringCoefficient</li><li>Kcore</li><li>Lpa</li><li>TriangleCount</li><li>Wcc</li></ul><h6 id=路径算法>路径算法:</h6><ul><li>RingsDetection</li><li>RingsDetectionWithFilter</li></ul><p>更多算法请看: <a href=https://github.com/apache/hugegraph-computer/tree/master/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm>Built-In algorithms</a></p><h3 id=42-算法描述>4.2 算法描述</h3><p>TODO</p><h2 id=5-算法开发指南>5 算法开发指南</h2><p>TODO</p><h2 id=6-注意事项>6 注意事项</h2><ul><li>如果computer-k8s模块下面的某些类不存在,你需要运行<code>mvn compile</code>来提前生成对应的类。</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-5074334c73aa450364a31470231ebff8>4 - Config</h1></div><div class=td-content><h1 id=pg-af7e8f1dc385b255c4f38b3cbafe224a>4.1 - HugeGraph 配置</h1><h3 id=1-概述>1 概述</h3><p>配置文件的目录为 hugegraph-release/conf,所有关于服务和图本身的配置都在此目录下。</p><p>主要的配置文件包括:gremlin-server.yaml、rest-server.properties 和 hugegraph.properties</p><p>HugeGraphServer 内部集成了 GremlinServer 和 RestServer,而 gremlin-server.yaml 和 rest-server.properties 就是用来配置这两个 Server 的。</p><ul><li><a href=http://tinkerpop.apache.org/docs/3.2.3/reference/#gremlin-server>GremlinServer</a>:GremlinServer 接受用户的 gremlin 语句,解析后转而调用 Core 的代码。</li><li>RestServer:提供 RESTful API,根据不同的 HTTP 请求,调用对应的 Core API,如果用户请求体是 gremlin 语句,则会转发给 GremlinServer,实现对图数据的操作。</li></ul><p>下面对这三个配置文件逐一介绍。</p><h3 id=2-gremlin-serveryaml>2 gremlin-server.yaml</h3><p>gremlin-server.yaml 文件默认的内容如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#8f5902;font-style:italic># host and port of gremlin server, need to be consistent with host and port in rest-server.properties</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic>#host: 127.0.0.1</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic>#port: 8182</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># Gremlin 查询中的超时时间(以毫秒为单位)</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>evaluationTimeout</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>30000</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>channelizer</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># 不要在此处设置图形,此功能将在支持动态添加图形后再进行处理</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>graphs</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>scriptEngines</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>gremlin-groovy</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>staticImports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.process.traversal.CustomPredicates.*&#39;,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.traversal.CustomFunctions.*</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>],</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>plugins</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>org.apache.hugegraph.plugin.HugeGraphGremlinPlugin</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>classImports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>java.lang.Math,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.backend.id.IdGenerator,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.type.define.Directions,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.type.define.NodeRole,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.CollectionPathsTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.CountTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.CustomizePathsTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.HugeTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.JaccardSimilarTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.KneighborTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.KoutTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.NeighborRankTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.PathsTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.PersonalRankTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.SameNeighborTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.ShortestPathTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.SubGraphTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.TemplatePathsTraverser,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.steps.EdgeStep,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.optimize.ConditionP,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.optimize.Text,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.traversal.optimize.TraversalUtil,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.util.DateUtil,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.traversal.CustomFunctions,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.traversal.CustomPredicate</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>],</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>methodImports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>java.lang.Math#*,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.traversal.CustomPredicate#*,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.opencypher.gremlin.traversal.CustomFunctions#*</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>files</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>scripts/empty-sample.groovy]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>serializers</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- {<span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>className</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>serializeResultToString</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ioRegistries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>org.apache.hugegraph.io.HugeGraphIoRegistry]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- {<span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>className</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>serializeResultToString</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ioRegistries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>org.apache.hugegraph.io.HugeGraphIoRegistry]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- {<span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>className</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>serializeResultToString</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ioRegistries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>org.apache.hugegraph.io.HugeGraphIoRegistry]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- {<span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>className</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>serializeResultToString</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ioRegistries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>org.apache.hugegraph.io.HugeGraphIoRegistry]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>metrics</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>consoleReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled: false, interval</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>180000</span>}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>csvReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled: false, interval: 180000, fileName</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>./metrics/gremlin-server-metrics.csv},</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>jmxReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span>}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>slf4jReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled: false, interval</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>180000</span>}<span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>gangliaReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled: false, interval: 180000, addressingMode</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>MULTICAST},</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>graphiteReporter</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>enabled: false, interval</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>180000</span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>maxInitialLineLength</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>4096</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>maxHeaderSize</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>8192</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>maxChunkSize</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>8192</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>maxContentLength</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>65536</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>maxAccumulationBufferComponents</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>1024</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>resultIterationBatchSize</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>64</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>writeBufferLowWaterMark</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>32768</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>writeBufferHighWaterMark</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>65536</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>ssl</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>enabled</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p>上面的配置项很多,但目前只需要关注如下几个配置项:channelizer 和 graphs。</p><ul><li>graphs:GremlinServer 启动时需要打开的图,该项是一个 map 结构,key 是图的名字,value 是该图的配置文件路径;</li><li>channelizer:GremlinServer 与客户端有两种通信方式,分别是 WebSocket 和 HTTP(默认)。如果选择 WebSocket,
用户可以通过 <a href=/clients/gremlin-console.html>Gremlin-Console</a> 快速体验 HugeGraph 的特性,但是不支持大规模数据导入,
推荐使用 HTTP 的通信方式,HugeGraph 的外围组件都是基于 HTTP 实现的;</li></ul><p>默认 GremlinServer 是服务在 localhost:8182,如果需要修改,配置 host、port 即可</p><ul><li>host:部署 GremlinServer 机器的机器名或 IP,目前 HugeGraphServer 不支持分布式部署,且 GremlinServer 不直接暴露给用户;</li><li>port:部署 GremlinServer 机器的端口;</li></ul><p>同时需要在 rest-server.properties 中增加对应的配置项 gremlinserver.url=http://host:port</p><h3 id=3-rest-serverproperties>3 rest-server.properties</h3><p>rest-server.properties 文件的默认内容如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span># bind url
</span></span><span style=display:flex><span>restserver.url=http://127.0.0.1:8080
</span></span><span style=display:flex><span># gremlin server url, need to be consistent with host and port in gremlin-server.yaml
</span></span><span style=display:flex><span>#gremlinserver.url=http://127.0.0.1:8182
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># graphs list with pair NAME:CONF_PATH
</span></span><span style=display:flex><span>graphs=[hugegraph:conf/hugegraph.properties]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># authentication
</span></span><span style=display:flex><span>#auth.authenticator=
</span></span><span style=display:flex><span>#auth.admin_token=
</span></span><span style=display:flex><span>#auth.user_tokens=[]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>server.id=server-1
</span></span><span style=display:flex><span>server.role=master
</span></span></code></pre></div><ul><li>restserver.url:RestServer 提供服务的 url,根据实际环境修改;</li><li>graphs:RestServer 启动时也需要打开图,该项为 map 结构,key 是图的名字,value 是该图的配置文件路径;</li></ul><blockquote><p>注意:gremlin-server.yaml 和 rest-server.properties 都包含 graphs 配置项,而 <code>init-store</code> 命令是根据 gremlin-server.yaml 的 graphs 下的图进行初始化的。</p></blockquote><blockquote><p>配置项 gremlinserver.url 是 GremlinServer 为 RestServer 提供服务的 url,该配置项默认为 http://localhost:8182,如需修改,需要和 gremlin-server.yaml 中的 host 和 port 相匹配;</p></blockquote><h3 id=4-hugegraphproperties>4 hugegraph.properties</h3><p>hugegraph.properties 是一类文件,因为如果系统存在多个图,则会有多个相似的文件。该文件用来配置与图存储和查询相关的参数,文件的默认内容如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span># gremlin entrence to create graph
</span></span><span style=display:flex><span>gremlin.graph=org.apache.hugegraph.HugeFactory
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># cache config
</span></span><span style=display:flex><span>#schema.cache_capacity=100000
</span></span><span style=display:flex><span># vertex-cache default is 1000w, 10min expired
</span></span><span style=display:flex><span>#vertex.cache_capacity=10000000
</span></span><span style=display:flex><span>#vertex.cache_expire=600
</span></span><span style=display:flex><span># edge-cache default is 100w, 10min expired
</span></span><span style=display:flex><span>#edge.cache_capacity=1000000
</span></span><span style=display:flex><span>#edge.cache_expire=600
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># schema illegal name template
</span></span><span style=display:flex><span>#schema.illegal_name_regex=\s+|~.*
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#vertex.default_label=vertex
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>store=hugegraph
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>raft.mode=false
</span></span><span style=display:flex><span>raft.safe_read=false
</span></span><span style=display:flex><span>raft.use_snapshot=false
</span></span><span style=display:flex><span>raft.endpoint=127.0.0.1:8281
</span></span><span style=display:flex><span>raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
</span></span><span style=display:flex><span>raft.path=./raft-log
</span></span><span style=display:flex><span>raft.use_replicator_pipeline=true
</span></span><span style=display:flex><span>raft.election_timeout=10000
</span></span><span style=display:flex><span>raft.snapshot_interval=3600
</span></span><span style=display:flex><span>raft.backend_threads=48
</span></span><span style=display:flex><span>raft.read_index_threads=8
</span></span><span style=display:flex><span>raft.queue_size=16384
</span></span><span style=display:flex><span>raft.queue_publish_timeout=60
</span></span><span style=display:flex><span>raft.apply_batch=1
</span></span><span style=display:flex><span>raft.rpc_threads=80
</span></span><span style=display:flex><span>raft.rpc_connect_timeout=5000
</span></span><span style=display:flex><span>raft.rpc_timeout=60000
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># if use &#39;ikanalyzer&#39;, need download jar from &#39;https://github.com/apache/hugegraph-doc/raw/ik_binary/dist/server/ikanalyzer-2012_u6.jar&#39; to lib directory
</span></span><span style=display:flex><span>search.text_analyzer=jieba
</span></span><span style=display:flex><span>search.text_analyzer_mode=INDEX
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># rocksdb backend config
</span></span><span style=display:flex><span>#rocksdb.data_path=/path/to/disk
</span></span><span style=display:flex><span>#rocksdb.wal_path=/path/to/disk
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># cassandra backend config
</span></span><span style=display:flex><span>cassandra.host=localhost
</span></span><span style=display:flex><span>cassandra.port=9042
</span></span><span style=display:flex><span>cassandra.username=
</span></span><span style=display:flex><span>cassandra.password=
</span></span><span style=display:flex><span>#cassandra.connect_timeout=5
</span></span><span style=display:flex><span>#cassandra.read_timeout=20
</span></span><span style=display:flex><span>#cassandra.keyspace.strategy=SimpleStrategy
</span></span><span style=display:flex><span>#cassandra.keyspace.replication=3
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># hbase backend config
</span></span><span style=display:flex><span>#hbase.hosts=localhost
</span></span><span style=display:flex><span>#hbase.port=2181
</span></span><span style=display:flex><span>#hbase.znode_parent=/hbase
</span></span><span style=display:flex><span>#hbase.threads_max=64
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># mysql backend config
</span></span><span style=display:flex><span>#jdbc.driver=com.mysql.jdbc.Driver
</span></span><span style=display:flex><span>#jdbc.url=jdbc:mysql://127.0.0.1:3306
</span></span><span style=display:flex><span>#jdbc.username=root
</span></span><span style=display:flex><span>#jdbc.password=
</span></span><span style=display:flex><span>#jdbc.reconnect_max_times=3
</span></span><span style=display:flex><span>#jdbc.reconnect_interval=3
</span></span><span style=display:flex><span>#jdbc.ssl_mode=false
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># postgresql &amp; cockroachdb backend config
</span></span><span style=display:flex><span>#jdbc.driver=org.postgresql.Driver
</span></span><span style=display:flex><span>#jdbc.url=jdbc:postgresql://localhost:5432/
</span></span><span style=display:flex><span>#jdbc.username=postgres
</span></span><span style=display:flex><span>#jdbc.password=
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># palo backend config
</span></span><span style=display:flex><span>#palo.host=127.0.0.1
</span></span><span style=display:flex><span>#palo.poll_interval=10
</span></span><span style=display:flex><span>#palo.temp_dir=./palo-data
</span></span><span style=display:flex><span>#palo.file_limit_size=32
</span></span></code></pre></div><p>重点关注未注释的几项:</p><ul><li>gremlin.graph:GremlinServer 的启动入口,用户不要修改此项;</li><li>backend:使用的后端存储,可选值有 memory、cassandra、scylladb、mysql、hbase、postgresql 和 rocksdb;</li><li>serializer:主要为内部使用,用于将 schema、vertex 和 edge 序列化到后端,对应的可选值为 text、cassandra、scylladb 和 binary;(注:rocksdb 后端值需是 binary,其他后端 backend 与 serializer 值需保持一致,如 hbase 后端该值为 hbase)</li><li>store:图存储到后端使用的数据库名,在 cassandra 和 scylladb 中就是 keyspace 名,此项的值与 GremlinServer 和 RestServer 中的图名并无关系,但是出于直观考虑,建议仍然使用相同的名字;</li><li>cassandra.host:backend 为 cassandra 或 scylladb 时此项才有意义,cassandra/scylladb 集群的 seeds;</li><li>cassandra.port:backend 为 cassandra 或 scylladb 时此项才有意义,cassandra/scylladb 集群的 native port;</li><li>rocksdb.data_path:backend 为 rocksdb 时此项才有意义,rocksdb 的数据目录</li><li>rocksdb.wal_path:backend 为 rocksdb 时此项才有意义,rocksdb 的日志目录</li><li>admin.token: 通过一个 token 来获取服务器的配置信息,例如:<a href="http://localhost:8080/graphs/hugegraph/conf?token=162f7848-0b6d-4faf-b557-3a0797869c55">http://localhost:8080/graphs/hugegraph/conf?token=162f7848-0b6d-4faf-b557-3a0797869c55</a></li></ul><h3 id=5-多图配置>5 多图配置</h3><p>我们的系统是可以存在多个图的,并且各个图的后端可以不一样,比如图 <code>hugegraph_rocksdb</code><code>hugegraph_mysql</code>,其中 <code>hugegraph_rocksdb</code><code>RocksDB</code> 作为后端,<code>hugegraph_mysql</code><code>MySQL</code> 作为后端。</p><p>配置方法也很简单:</p><p><strong>[可选]:修改 rest-server.properties</strong></p><p>通过修改 <code>rest-server.properties</code> 中的 <code>graphs</code> 配置项来设置图的配置文件目录。默认配置为 <code>graphs=./conf/graphs</code>,如果想要修改为其它目录则调整 <code>graphs</code> 配置项,比如调整为 <code>graphs=/etc/hugegraph/graphs</code>,示例如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>graphs=./conf/graphs
</span></span></code></pre></div><p><code>conf/graphs</code> 路径下基于 <code>hugegraph.properties</code> 修改得到 <code>hugegraph_mysql_backend.properties</code><code>hugegraph_rocksdb_backend.properties</code></p><p><code>hugegraph_mysql_backend.properties</code> 修改的部分如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=mysql
</span></span><span style=display:flex><span>serializer=mysql
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>store=hugegraph_mysql
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># mysql backend config
</span></span><span style=display:flex><span>jdbc.driver=com.mysql.cj.jdbc.Driver
</span></span><span style=display:flex><span>jdbc.url=jdbc:mysql://127.0.0.1:3306
</span></span><span style=display:flex><span>jdbc.username=root
</span></span><span style=display:flex><span>jdbc.password=123456
</span></span><span style=display:flex><span>jdbc.reconnect_max_times=3
</span></span><span style=display:flex><span>jdbc.reconnect_interval=3
</span></span><span style=display:flex><span>jdbc.ssl_mode=false
</span></span></code></pre></div><p><code>hugegraph_rocksdb_backend.properties</code> 修改的部分如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>store=hugegraph_rocksdb
</span></span></code></pre></div><p><strong>停止 Server,初始化执行 init-store.sh(为新的图创建数据库),重新启动 Server</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>$ ./bin/stop-hugegraph.sh
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>$ ./bin/init-store.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Initializing HugeGraph Store...
</span></span><span style=display:flex><span>2023-06-11 14:16:14 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.u.ConfigUtil - Scanning option <span style=color:#4e9a06>&#39;graphs&#39;</span> directory <span style=color:#4e9a06>&#39;./conf/graphs&#39;</span>
</span></span><span style=display:flex><span>2023-06-11 14:16:14 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.c.InitStore - Init graph with config file: ./conf/graphs/hugegraph_rocksdb_backend.properties
</span></span><span style=display:flex><span>...
</span></span><span style=display:flex><span>2023-06-11 14:16:15 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.StandardHugeGraph - Graph <span style=color:#4e9a06>&#39;hugegraph_rocksdb&#39;</span> has been initialized
</span></span><span style=display:flex><span>2023-06-11 14:16:15 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.c.InitStore - Init graph with config file: ./conf/graphs/hugegraph_mysql_backend.properties
</span></span><span style=display:flex><span>...
</span></span><span style=display:flex><span>2023-06-11 14:16:16 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.StandardHugeGraph - Graph <span style=color:#4e9a06>&#39;hugegraph_mysql&#39;</span> has been initialized
</span></span><span style=display:flex><span>2023-06-11 14:16:16 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.StandardHugeGraph - Close graph standardhugegraph<span style=color:#ce5c00;font-weight:700>[</span>hugegraph_rocksdb<span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span>...
</span></span><span style=display:flex><span>2023-06-11 14:16:16 <span style=color:#ce5c00;font-weight:700>[</span>main<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.HugeFactory - HugeFactory shutdown
</span></span><span style=display:flex><span>2023-06-11 14:16:16 <span style=color:#ce5c00;font-weight:700>[</span>hugegraph-shutdown<span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span>INFO<span style=color:#ce5c00;font-weight:700>]</span> o.a.h.HugeFactory - HugeGraph is shutting down
</span></span><span style=display:flex><span>Initialization finished.
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>$ ./bin/start-hugegraph.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Starting HugeGraphServer...
</span></span><span style=display:flex><span>Connecting to HugeGraphServer <span style=color:#ce5c00;font-weight:700>(</span>http://127.0.0.1:8080/graphs<span style=color:#ce5c00;font-weight:700>)</span>...OK
</span></span><span style=display:flex><span>Started <span style=color:#ce5c00;font-weight:700>[</span>pid 21614<span style=color:#ce5c00;font-weight:700>]</span>
</span></span></code></pre></div><p>查看创建的图:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl http://127.0.0.1:8080/graphs/
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;graphs&#34;</span>:<span style=color:#ce5c00;font-weight:700>[</span><span style=color:#4e9a06>&#34;hugegraph_rocksdb&#34;</span>,<span style=color:#4e9a06>&#34;hugegraph_mysql&#34;</span><span style=color:#ce5c00;font-weight:700>]}</span>
</span></span></code></pre></div><p>查看某个图的信息:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl http://127.0.0.1:8080/graphs/hugegraph_mysql_backend
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;hugegraph_mysql&#34;</span>,<span style=color:#4e9a06>&#34;backend&#34;</span>:<span style=color:#4e9a06>&#34;mysql&#34;</span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl http://127.0.0.1:8080/graphs/hugegraph_rocksdb_backend
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>{</span><span style=color:#4e9a06>&#34;name&#34;</span>:<span style=color:#4e9a06>&#34;hugegraph_rocksdb&#34;</span>,<span style=color:#4e9a06>&#34;backend&#34;</span>:<span style=color:#4e9a06>&#34;rocksdb&#34;</span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-6bfbb2db4e1f281942d741cef305e724>4.2 - HugeGraph 配置项</h1><h3 id=gremlin-server-配置项>Gremlin Server 配置项</h3><p>对应配置文件<code>gremlin-server.yaml</code></p><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>host</td><td>127.0.0.1</td><td>The host or ip of Gremlin Server.</td></tr><tr><td>port</td><td>8182</td><td>The listening port of Gremlin Server.</td></tr><tr><td>graphs</td><td>hugegraph: conf/hugegraph.properties</td><td>The map of graphs with name and config file path.</td></tr><tr><td>scriptEvaluationTimeout</td><td>30000</td><td>The timeout for gremlin script execution(millisecond).</td></tr><tr><td>channelizer</td><td>org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer</td><td>Indicates the protocol which the Gremlin Server provides service.</td></tr><tr><td>authentication</td><td>authenticator: org.apache.hugegraph.auth.StandardAuthenticator, config: {tokens: conf/rest-server.properties}</td><td>The authenticator and config(contains tokens path) of authentication mechanism.</td></tr></tbody></table><h3 id=rest-server--api-配置项>Rest Server & API 配置项</h3><p>对应配置文件<code>rest-server.properties</code></p><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>graphs</td><td>[hugegraph:conf/hugegraph.properties]</td><td>The map of graphs&rsquo; name and config file.</td></tr><tr><td>server.id</td><td>server-1</td><td>The id of rest server, used for license verification.</td></tr><tr><td>server.role</td><td>master</td><td>The role of nodes in the cluster, available types are [master, worker, computer]</td></tr><tr><td>restserver.url</td><td>http://127.0.0.1:8080</td><td>The url for listening of rest server.</td></tr><tr><td>ssl.keystore_file</td><td>server.keystore</td><td>The path of server keystore file used when https protocol is enabled.</td></tr><tr><td>ssl.keystore_password</td><td></td><td>The password of the path of the server keystore file used when the https protocol is enabled.</td></tr><tr><td>restserver.max_worker_threads</td><td>2 * CPUs</td><td>The maximum worker threads of rest server.</td></tr><tr><td>restserver.min_free_memory</td><td>64</td><td>The minimum free memory(MB) of rest server, requests will be rejected when the available memory of system is lower than this value.</td></tr><tr><td>restserver.request_timeout</td><td>30</td><td>The time in seconds within which a request must complete, -1 means no timeout.</td></tr><tr><td>restserver.connection_idle_timeout</td><td>30</td><td>The time in seconds to keep an inactive connection alive, -1 means no timeout.</td></tr><tr><td>restserver.connection_max_requests</td><td>256</td><td>The max number of HTTP requests allowed to be processed on one keep-alive connection, -1 means unlimited.</td></tr><tr><td>gremlinserver.url</td><td>http://127.0.0.1:8182</td><td>The url of gremlin server.</td></tr><tr><td>gremlinserver.max_route</td><td>8</td><td>The max route number for gremlin server.</td></tr><tr><td>gremlinserver.timeout</td><td>30</td><td>The timeout in seconds of waiting for gremlin server.</td></tr><tr><td>batch.max_edges_per_batch</td><td>500</td><td>The maximum number of edges submitted per batch.</td></tr><tr><td>batch.max_vertices_per_batch</td><td>500</td><td>The maximum number of vertices submitted per batch.</td></tr><tr><td>batch.max_write_ratio</td><td>50</td><td>The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0.</td></tr><tr><td>batch.max_write_threads</td><td>0</td><td>The maximum threads for batch writing, if the value is 0, the actual value will be set to batch.max_write_ratio * restserver.max_worker_threads.</td></tr><tr><td>auth.authenticator</td><td></td><td>The class path of authenticator implementation. e.g., org.apache.hugegraph.auth.StandardAuthenticator, or org.apache.hugegraph.auth.ConfigAuthenticator.</td></tr><tr><td>auth.admin_token</td><td>162f7848-0b6d-4faf-b557-3a0797869c55</td><td>Token for administrator operations, only for org.apache.hugegraph.auth.ConfigAuthenticator.</td></tr><tr><td>auth.graph_store</td><td>hugegraph</td><td>The name of graph used to store authentication information, like users, only for org.apache.hugegraph.auth.StandardAuthenticator.</td></tr><tr><td>auth.user_tokens</td><td>[hugegraph:9fd95c9c-711b-415b-b85f-d4df46ba5c31]</td><td>The map of user tokens with name and password, only for org.apache.hugegraph.auth.ConfigAuthenticator.</td></tr><tr><td>auth.audit_log_rate</td><td>1000.0</td><td>The max rate of audit log output per user, default value is 1000 records per second.</td></tr><tr><td>auth.cache_capacity</td><td>10240</td><td>The max cache capacity of each auth cache item.</td></tr><tr><td>auth.cache_expire</td><td>600</td><td>The expiration time in seconds of vertex cache.</td></tr><tr><td>auth.remote_url</td><td></td><td>If the address is empty, it provide auth service, otherwise it is auth client and also provide auth service through rpc forwarding. The remote url can be set to multiple addresses, which are concat by &lsquo;,&rsquo;.</td></tr><tr><td>auth.token_expire</td><td>86400</td><td>The expiration time in seconds after token created</td></tr><tr><td>auth.token_secret</td><td>FXQXbJtbCLxODc6tGci732pkH1cyf8Qg</td><td>Secret key of HS256 algorithm.</td></tr><tr><td>exception.allow_trace</td><td>false</td><td>Whether to allow exception trace stack.</td></tr></tbody></table><h3 id=基本配置项>基本配置项</h3><p>基本配置项及后端配置项对应配置文件:{graph-name}.properties,如<code>hugegraph.properties</code></p><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>gremlin.graph</td><td>org.apache.hugegraph.HugeFactory</td><td>Gremlin entrance to create graph.</td></tr><tr><td>backend</td><td>rocksdb</td><td>The data store type, available values are [memory, rocksdb, cassandra, scylladb, hbase, mysql].</td></tr><tr><td>serializer</td><td>binary</td><td>The serializer for backend store, available values are [text, binary, cassandra, hbase, mysql].</td></tr><tr><td>store</td><td>hugegraph</td><td>The database name like Cassandra Keyspace.</td></tr><tr><td>store.connection_detect_interval</td><td>600</td><td>The interval in seconds for detecting connections, if the idle time of a connection exceeds this value, detect it and reconnect if needed before using, value 0 means detecting every time.</td></tr><tr><td>store.graph</td><td>g</td><td>The graph table name, which store vertex, edge and property.</td></tr><tr><td>store.schema</td><td>m</td><td>The schema table name, which store meta data.</td></tr><tr><td>store.system</td><td>s</td><td>The system table name, which store system data.</td></tr><tr><td>schema.illegal_name_regex</td><td>.<em>\s+$|~.</em></td><td>The regex specified the illegal format for schema name.</td></tr><tr><td>schema.cache_capacity</td><td>10000</td><td>The max cache size(items) of schema cache.</td></tr><tr><td>vertex.cache_type</td><td>l2</td><td>The type of vertex cache, allowed values are [l1, l2].</td></tr><tr><td>vertex.cache_capacity</td><td>10000000</td><td>The max cache size(items) of vertex cache.</td></tr><tr><td>vertex.cache_expire</td><td>600</td><td>The expire time in seconds of vertex cache.</td></tr><tr><td>vertex.check_customized_id_exist</td><td>false</td><td>Whether to check the vertices exist for those using customized id strategy.</td></tr><tr><td>vertex.default_label</td><td>vertex</td><td>The default vertex label.</td></tr><tr><td>vertex.tx_capacity</td><td>10000</td><td>The max size(items) of vertices(uncommitted) in transaction.</td></tr><tr><td>vertex.check_adjacent_vertex_exist</td><td>false</td><td>Whether to check the adjacent vertices of edges exist.</td></tr><tr><td>vertex.lazy_load_adjacent_vertex</td><td>true</td><td>Whether to lazy load adjacent vertices of edges.</td></tr><tr><td>vertex.part_edge_commit_size</td><td>5000</td><td>Whether to enable the mode to commit part of edges of vertex, enabled if commit size > 0, 0 means disabled.</td></tr><tr><td>vertex.encode_primary_key_number</td><td>true</td><td>Whether to encode number value of primary key in vertex id.</td></tr><tr><td>vertex.remove_left_index_at_overwrite</td><td>false</td><td>Whether remove left index at overwrite.</td></tr><tr><td>edge.cache_type</td><td>l2</td><td>The type of edge cache, allowed values are [l1, l2].</td></tr><tr><td>edge.cache_capacity</td><td>1000000</td><td>The max cache size(items) of edge cache.</td></tr><tr><td>edge.cache_expire</td><td>600</td><td>The expiration time in seconds of edge cache.</td></tr><tr><td>edge.tx_capacity</td><td>10000</td><td>The max size(items) of edges(uncommitted) in transaction.</td></tr><tr><td>query.page_size</td><td>500</td><td>The size of each page when querying by paging.</td></tr><tr><td>query.batch_size</td><td>1000</td><td>The size of each batch when querying by batch.</td></tr><tr><td>query.ignore_invalid_data</td><td>true</td><td>Whether to ignore invalid data of vertex or edge.</td></tr><tr><td>query.index_intersect_threshold</td><td>1000</td><td>The maximum number of intermediate results to intersect indexes when querying by multiple single index properties.</td></tr><tr><td>query.ramtable_edges_capacity</td><td>20000000</td><td>The maximum number of edges in ramtable, include OUT and IN edges.</td></tr><tr><td>query.ramtable_enable</td><td>false</td><td>Whether to enable ramtable for query of adjacent edges.</td></tr><tr><td>query.ramtable_vertices_capacity</td><td>10000000</td><td>The maximum number of vertices in ramtable, generally the largest vertex id is used as capacity.</td></tr><tr><td>query.optimize_aggregate_by_index</td><td>false</td><td>Whether to optimize aggregate query(like count) by index.</td></tr><tr><td>oltp.concurrent_depth</td><td>10</td><td>The min depth to enable concurrent oltp algorithm.</td></tr><tr><td>oltp.concurrent_threads</td><td>10</td><td>Thread number to concurrently execute oltp algorithm.</td></tr><tr><td>oltp.collection_type</td><td>EC</td><td>The implementation type of collections used in oltp algorithm.</td></tr><tr><td>rate_limit.read</td><td>0</td><td>The max rate(times/s) to execute query of vertices/edges.</td></tr><tr><td>rate_limit.write</td><td>0</td><td>The max rate(items/s) to add/update/delete vertices/edges.</td></tr><tr><td>task.wait_timeout</td><td>10</td><td>Timeout in seconds for waiting for the task to complete,such as when truncating or clearing the backend.</td></tr><tr><td>task.input_size_limit</td><td>16777216</td><td>The job input size limit in bytes.</td></tr><tr><td>task.result_size_limit</td><td>16777216</td><td>The job result size limit in bytes.</td></tr><tr><td>task.sync_deletion</td><td>false</td><td>Whether to delete schema or expired data synchronously.</td></tr><tr><td>task.ttl_delete_batch</td><td>1</td><td>The batch size used to delete expired data.</td></tr><tr><td>computer.config</td><td>/conf/computer.yaml</td><td>The config file path of computer job.</td></tr><tr><td>search.text_analyzer</td><td>ikanalyzer</td><td>Choose a text analyzer for searching the vertex/edge properties, available type are [word, ansj, hanlp, smartcn, jieba, jcseg, mmseg4j, ikanalyzer]. # if use &lsquo;ikanalyzer&rsquo;, need download jar from &lsquo;<a href="https://github.com/apache/hugegraph-doc/raw/ik_binary/dist/server/ikanalyzer-2012_u6.jar'">https://github.com/apache/hugegraph-doc/raw/ik_binary/dist/server/ikanalyzer-2012_u6.jar'</a> to lib directory</td></tr><tr><td>search.text_analyzer_mode</td><td>smart</td><td>Specify the mode for the text analyzer, the available mode of analyzer are {word: [MaximumMatching, ReverseMaximumMatching, MinimumMatching, ReverseMinimumMatching, BidirectionalMaximumMatching, BidirectionalMinimumMatching, BidirectionalMaximumMinimumMatching, FullSegmentation, MinimalWordCount, MaxNgramScore, PureEnglish], ansj: [BaseAnalysis, IndexAnalysis, ToAnalysis, NlpAnalysis], hanlp: [standard, nlp, index, nShort, shortest, speed], smartcn: [], jieba: [SEARCH, INDEX], jcseg: [Simple, Complex], mmseg4j: [Simple, Complex, MaxWord], ikanalyzer: [smart, max_word]}.</td></tr><tr><td>snowflake.datecenter_id</td><td>0</td><td>The datacenter id of snowflake id generator.</td></tr><tr><td>snowflake.force_string</td><td>false</td><td>Whether to force the snowflake long id to be a string.</td></tr><tr><td>snowflake.worker_id</td><td>0</td><td>The worker id of snowflake id generator.</td></tr><tr><td>raft.mode</td><td>false</td><td>Whether the backend storage works in raft mode.</td></tr><tr><td>raft.safe_read</td><td>false</td><td>Whether to use linearly consistent read.</td></tr><tr><td>raft.use_snapshot</td><td>false</td><td>Whether to use snapshot.</td></tr><tr><td>raft.endpoint</td><td>127.0.0.1:8281</td><td>The peerid of current raft node.</td></tr><tr><td>raft.group_peers</td><td>127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283</td><td>The peers of current raft group.</td></tr><tr><td>raft.path</td><td>./raft-log</td><td>The log path of current raft node.</td></tr><tr><td>raft.use_replicator_pipeline</td><td>true</td><td>Whether to use replicator line, when turned on it multiple logs can be sent in parallel, and the next log doesn&rsquo;t have to wait for the ack message of the current log to be sent.</td></tr><tr><td>raft.election_timeout</td><td>10000</td><td>Timeout in milliseconds to launch a round of election.</td></tr><tr><td>raft.snapshot_interval</td><td>3600</td><td>The interval in seconds to trigger snapshot save.</td></tr><tr><td>raft.backend_threads</td><td>current CPU v-cores</td><td>The thread number used to apply task to backend.</td></tr><tr><td>raft.read_index_threads</td><td>8</td><td>The thread number used to execute reading index.</td></tr><tr><td>raft.apply_batch</td><td>1</td><td>The apply batch size to trigger disruptor event handler.</td></tr><tr><td>raft.queue_size</td><td>16384</td><td>The disruptor buffers size for jraft RaftNode, StateMachine and LogManager.</td></tr><tr><td>raft.queue_publish_timeout</td><td>60</td><td>The timeout in second when publish event into disruptor.</td></tr><tr><td>raft.rpc_threads</td><td>80</td><td>The rpc threads for jraft RPC layer.</td></tr><tr><td>raft.rpc_connect_timeout</td><td>5000</td><td>The rpc connect timeout for jraft rpc.</td></tr><tr><td>raft.rpc_timeout</td><td>60000</td><td>The rpc timeout for jraft rpc.</td></tr><tr><td>raft.rpc_buf_low_water_mark</td><td>10485760</td><td>The ChannelOutboundBuffer&rsquo;s low water mark of netty, when buffer size less than this size, the method ChannelOutboundBuffer.isWritable() will return true, it means that low downstream pressure or good network.</td></tr><tr><td>raft.rpc_buf_high_water_mark</td><td>20971520</td><td>The ChannelOutboundBuffer&rsquo;s high water mark of netty, only when buffer size exceed this size, the method ChannelOutboundBuffer.isWritable() will return false, it means that the downstream pressure is too great to process the request or network is very congestion, upstream needs to limit rate at this time.</td></tr><tr><td>raft.read_strategy</td><td>ReadOnlyLeaseBased</td><td>The linearizability of read strategy.</td></tr></tbody></table><h3 id=rpc-server-配置>RPC server 配置</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>rpc.client_connect_timeout</td><td>20</td><td>The timeout(in seconds) of rpc client connect to rpc server.</td></tr><tr><td>rpc.client_load_balancer</td><td>consistentHash</td><td>The rpc client uses a load-balancing algorithm to access multiple rpc servers in one cluster. Default value is &lsquo;consistentHash&rsquo;, means forwarding by request parameters.</td></tr><tr><td>rpc.client_read_timeout</td><td>40</td><td>The timeout(in seconds) of rpc client read from rpc server.</td></tr><tr><td>rpc.client_reconnect_period</td><td>10</td><td>The period(in seconds) of rpc client reconnect to rpc server.</td></tr><tr><td>rpc.client_retries</td><td>3</td><td>Failed retry number of rpc client calls to rpc server.</td></tr><tr><td>rpc.config_order</td><td>999</td><td>Sofa rpc configuration file loading order, the larger the more later loading.</td></tr><tr><td>rpc.logger_impl</td><td>com.alipay.sofa.rpc.log.SLF4JLoggerImpl</td><td>Sofa rpc log implementation class.</td></tr><tr><td>rpc.protocol</td><td>bolt</td><td>Rpc communication protocol, client and server need to be specified the same value.</td></tr><tr><td>rpc.remote_url</td><td></td><td>The remote urls of rpc peers, it can be set to multiple addresses, which are concat by &lsquo;,&rsquo;, empty value means not enabled.</td></tr><tr><td>rpc.server_adaptive_port</td><td>false</td><td>Whether the bound port is adaptive, if it&rsquo;s enabled, when the port is in use, automatically +1 to detect the next available port. Note that this process is not atomic, so there may still be port conflicts.</td></tr><tr><td>rpc.server_host</td><td></td><td>The hosts/ips bound by rpc server to provide services, empty value means not enabled.</td></tr><tr><td>rpc.server_port</td><td>8090</td><td>The port bound by rpc server to provide services.</td></tr><tr><td>rpc.server_timeout</td><td>30</td><td>The timeout(in seconds) of rpc server execution.</td></tr></tbody></table><h3 id=cassandra-后端配置项>Cassandra 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>cassandra</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>cassandra</code>.</td></tr><tr><td>cassandra.host</td><td>localhost</td><td>The seeds hostname or ip address of cassandra cluster.</td></tr><tr><td>cassandra.port</td><td>9042</td><td>The seeds port address of cassandra cluster.</td></tr><tr><td>cassandra.connect_timeout</td><td>5</td><td>The cassandra driver connect server timeout(seconds).</td></tr><tr><td>cassandra.read_timeout</td><td>20</td><td>The cassandra driver read from server timeout(seconds).</td></tr><tr><td>cassandra.keyspace.strategy</td><td>SimpleStrategy</td><td>The replication strategy of keyspace, valid value is SimpleStrategy or NetworkTopologyStrategy.</td></tr><tr><td>cassandra.keyspace.replication</td><td>[3]</td><td>The keyspace replication factor of SimpleStrategy, like &lsquo;[3]&rsquo;.Or replicas in each datacenter of NetworkTopologyStrategy, like &lsquo;[dc1:2,dc2:1]&rsquo;.</td></tr><tr><td>cassandra.username</td><td></td><td>The username to use to login to cassandra cluster.</td></tr><tr><td>cassandra.password</td><td></td><td>The password corresponding to cassandra.username.</td></tr><tr><td>cassandra.compression_type</td><td>none</td><td>The compression algorithm of cassandra transport: none/snappy/lz4.</td></tr><tr><td>cassandra.jmx_port=7199</td><td>7199</td><td>The port of JMX API service for cassandra.</td></tr><tr><td>cassandra.aggregation_timeout</td><td>43200</td><td>The timeout in seconds of waiting for aggregation.</td></tr></tbody></table><h3 id=scylladb-后端配置项>ScyllaDB 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>scylladb</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>scylladb</code>.</td></tr></tbody></table><p>其它与 Cassandra 后端一致。</p><h3 id=rocksdb-后端配置项>RocksDB 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>rocksdb</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>binary</code>.</td></tr><tr><td>rocksdb.data_disks</td><td>[]</td><td>The optimized disks for storing data of RocksDB. The format of each element: <code>STORE/TABLE: /path/disk</code>.Allowed keys are [g/vertex, g/edge_out, g/edge_in, g/vertex_label_index, g/edge_label_index, g/range_int_index, g/range_float_index, g/range_long_index, g/range_double_index, g/secondary_index, g/search_index, g/shard_index, g/unique_index, g/olap]</td></tr><tr><td>rocksdb.data_path</td><td>rocksdb-data/data</td><td>The path for storing data of RocksDB.</td></tr><tr><td>rocksdb.wal_path</td><td>rocksdb-data/wal</td><td>The path for storing WAL of RocksDB.</td></tr><tr><td>rocksdb.allow_mmap_reads</td><td>false</td><td>Allow the OS to mmap file for reading sst tables.</td></tr><tr><td>rocksdb.allow_mmap_writes</td><td>false</td><td>Allow the OS to mmap file for writing.</td></tr><tr><td>rocksdb.block_cache_capacity</td><td>8388608</td><td>The amount of block cache in bytes that will be used by RocksDB, 0 means no block cache.</td></tr><tr><td>rocksdb.bloom_filter_bits_per_key</td><td>-1</td><td>The bits per key in bloom filter, a good value is 10, which yields a filter with ~ 1% false positive rate, -1 means no bloom filter.</td></tr><tr><td>rocksdb.bloom_filter_block_based_mode</td><td>false</td><td>Use block based filter rather than full filter.</td></tr><tr><td>rocksdb.bloom_filter_whole_key_filtering</td><td>true</td><td>True if place whole keys in the bloom filter, else place the prefix of keys.</td></tr><tr><td>rocksdb.bottommost_compression</td><td>NO_COMPRESSION</td><td>The compression algorithm for the bottommost level of RocksDB, allowed values are none/snappy/z/bzip2/lz4/lz4hc/xpress/zstd.</td></tr><tr><td>rocksdb.bulkload_mode</td><td>false</td><td>Switch to the mode to bulk load data into RocksDB.</td></tr><tr><td>rocksdb.cache_index_and_filter_blocks</td><td>false</td><td>Indicating if we&rsquo;d put index/filter blocks to the block cache.</td></tr><tr><td>rocksdb.compaction_style</td><td>LEVEL</td><td>Set compaction style for RocksDB: LEVEL/UNIVERSAL/FIFO.</td></tr><tr><td>rocksdb.compression</td><td>SNAPPY_COMPRESSION</td><td>The compression algorithm for compressing blocks of RocksDB, allowed values are none/snappy/z/bzip2/lz4/lz4hc/xpress/zstd.</td></tr><tr><td>rocksdb.compression_per_level</td><td>[NO_COMPRESSION, NO_COMPRESSION, SNAPPY_COMPRESSION, SNAPPY_COMPRESSION, SNAPPY_COMPRESSION, SNAPPY_COMPRESSION, SNAPPY_COMPRESSION]</td><td>The compression algorithms for different levels of RocksDB, allowed values are none/snappy/z/bzip2/lz4/lz4hc/xpress/zstd.</td></tr><tr><td>rocksdb.delayed_write_rate</td><td>16777216</td><td>The rate limit in bytes/s of user write requests when need to slow down if the compaction gets behind.</td></tr><tr><td>rocksdb.log_level</td><td>INFO</td><td>The info log level of RocksDB.</td></tr><tr><td>rocksdb.max_background_jobs</td><td>8</td><td>Maximum number of concurrent background jobs, including flushes and compactions.</td></tr><tr><td>rocksdb.level_compaction_dynamic_level_bytes</td><td>false</td><td>Whether to enable level_compaction_dynamic_level_bytes, if it&rsquo;s enabled we give max_bytes_for_level_multiplier a priority against max_bytes_for_level_base, the bytes of base level is dynamic for a more predictable LSM tree, it is useful to limit worse case space amplification. Turning this feature on/off for an existing DB can cause unexpected LSM tree structure so it&rsquo;s not recommended.</td></tr><tr><td>rocksdb.max_bytes_for_level_base</td><td>536870912</td><td>The upper-bound of the total size of level-1 files in bytes.</td></tr><tr><td>rocksdb.max_bytes_for_level_multiplier</td><td>10.0</td><td>The ratio between the total size of level (L+1) files and the total size of level L files for all L.</td></tr><tr><td>rocksdb.max_open_files</td><td>-1</td><td>The maximum number of open files that can be cached by RocksDB, -1 means no limit.</td></tr><tr><td>rocksdb.max_subcompactions</td><td>4</td><td>The value represents the maximum number of threads per compaction job.</td></tr><tr><td>rocksdb.max_write_buffer_number</td><td>6</td><td>The maximum number of write buffers that are built up in memory.</td></tr><tr><td>rocksdb.max_write_buffer_number_to_maintain</td><td>0</td><td>The total maximum number of write buffers to maintain in memory.</td></tr><tr><td>rocksdb.min_write_buffer_number_to_merge</td><td>2</td><td>The minimum number of write buffers that will be merged together.</td></tr><tr><td>rocksdb.num_levels</td><td>7</td><td>Set the number of levels for this database.</td></tr><tr><td>rocksdb.optimize_filters_for_hits</td><td>false</td><td>This flag allows us to not store filters for the last level.</td></tr><tr><td>rocksdb.optimize_mode</td><td>true</td><td>Optimize for heavy workloads and big datasets.</td></tr><tr><td>rocksdb.pin_l0_filter_and_index_blocks_in_cache</td><td>false</td><td>Indicating if we&rsquo;d put index/filter blocks to the block cache.</td></tr><tr><td>rocksdb.sst_path</td><td></td><td>The path for ingesting SST file into RocksDB.</td></tr><tr><td>rocksdb.target_file_size_base</td><td>67108864</td><td>The target file size for compaction in bytes.</td></tr><tr><td>rocksdb.target_file_size_multiplier</td><td>1</td><td>The size ratio between a level L file and a level (L+1) file.</td></tr><tr><td>rocksdb.use_direct_io_for_flush_and_compaction</td><td>false</td><td>Enable the OS to use direct read/writes in flush and compaction.</td></tr><tr><td>rocksdb.use_direct_reads</td><td>false</td><td>Enable the OS to use direct I/O for reading sst tables.</td></tr><tr><td>rocksdb.write_buffer_size</td><td>134217728</td><td>Amount of data in bytes to build up in memory.</td></tr><tr><td>rocksdb.max_manifest_file_size</td><td>104857600</td><td>The max size of manifest file in bytes.</td></tr><tr><td>rocksdb.skip_stats_update_on_db_open</td><td>false</td><td>Whether to skip statistics update when opening the database, setting this flag true allows us to not update statistics.</td></tr><tr><td>rocksdb.max_file_opening_threads</td><td>16</td><td>The max number of threads used to open files.</td></tr><tr><td>rocksdb.max_total_wal_size</td><td>0</td><td>Total size of WAL files in bytes. Once WALs exceed this size, we will start forcing the flush of column families related, 0 means no limit.</td></tr><tr><td>rocksdb.db_write_buffer_size</td><td>0</td><td>Total size of write buffers in bytes across all column families, 0 means no limit.</td></tr><tr><td>rocksdb.delete_obsolete_files_period</td><td>21600</td><td>The periodicity in seconds when obsolete files get deleted, 0 means always do full purge.</td></tr><tr><td>rocksdb.hard_pending_compaction_bytes_limit</td><td>274877906944</td><td>The hard limit to impose on pending compaction in bytes.</td></tr><tr><td>rocksdb.level0_file_num_compaction_trigger</td><td>2</td><td>Number of files to trigger level-0 compaction.</td></tr><tr><td>rocksdb.level0_slowdown_writes_trigger</td><td>20</td><td>Soft limit on number of level-0 files for slowing down writes.</td></tr><tr><td>rocksdb.level0_stop_writes_trigger</td><td>36</td><td>Hard limit on number of level-0 files for stopping writes.</td></tr><tr><td>rocksdb.soft_pending_compaction_bytes_limit</td><td>68719476736</td><td>The soft limit to impose on pending compaction in bytes.</td></tr></tbody></table><h3 id=hbase-后端配置项>HBase 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>hbase</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>hbase</code>.</td></tr><tr><td>hbase.hosts</td><td>localhost</td><td>The hostnames or ip addresses of HBase zookeeper, separated with commas.</td></tr><tr><td>hbase.port</td><td>2181</td><td>The port address of HBase zookeeper.</td></tr><tr><td>hbase.threads_max</td><td>64</td><td>The max threads num of hbase connections.</td></tr><tr><td>hbase.znode_parent</td><td>/hbase</td><td>The znode parent path of HBase zookeeper.</td></tr><tr><td>hbase.zk_retry</td><td>3</td><td>The recovery retry times of HBase zookeeper.</td></tr><tr><td>hbase.aggregation_timeout</td><td>43200</td><td>The timeout in seconds of waiting for aggregation.</td></tr><tr><td>hbase.kerberos_enable</td><td>false</td><td>Is Kerberos authentication enabled for HBase.</td></tr><tr><td>hbase.kerberos_keytab</td><td></td><td>The HBase&rsquo;s key tab file for kerberos authentication.</td></tr><tr><td>hbase.kerberos_principal</td><td></td><td>The HBase&rsquo;s principal for kerberos authentication.</td></tr><tr><td>hbase.krb5_conf</td><td>etc/krb5.conf</td><td>Kerberos configuration file, including KDC IP, default realm, etc.</td></tr><tr><td>hbase.hbase_site</td><td>/etc/hbase/conf/hbase-site.xml</td><td>The HBase&rsquo;s configuration file</td></tr><tr><td>hbase.enable_partition</td><td>true</td><td>Is pre-split partitions enabled for HBase.</td></tr><tr><td>hbase.vertex_partitions</td><td>10</td><td>The number of partitions of the HBase vertex table.</td></tr><tr><td>hbase.edge_partitions</td><td>30</td><td>The number of partitions of the HBase edge table.</td></tr></tbody></table><h3 id=mysql--postgresql-后端配置项>MySQL & PostgreSQL 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>mysql</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>mysql</code>.</td></tr><tr><td>jdbc.driver</td><td>com.mysql.jdbc.Driver</td><td>The JDBC driver class to connect database.</td></tr><tr><td>jdbc.url</td><td>jdbc:mysql://127.0.0.1:3306</td><td>The url of database in JDBC format.</td></tr><tr><td>jdbc.username</td><td>root</td><td>The username to login database.</td></tr><tr><td>jdbc.password</td><td>******</td><td>The password corresponding to jdbc.username.</td></tr><tr><td>jdbc.ssl_mode</td><td>false</td><td>The SSL mode of connections with database.</td></tr><tr><td>jdbc.reconnect_interval</td><td>3</td><td>The interval(seconds) between reconnections when the database connection fails.</td></tr><tr><td>jdbc.reconnect_max_times</td><td>3</td><td>The reconnect times when the database connection fails.</td></tr><tr><td>jdbc.storage_engine</td><td>InnoDB</td><td>The storage engine of backend store database, like InnoDB/MyISAM/RocksDB for MySQL.</td></tr><tr><td>jdbc.postgresql.connect_database</td><td>template1</td><td>The database used to connect when init store, drop store or check store exist.</td></tr></tbody></table><h3 id=postgresql-后端配置项>PostgreSQL 后端配置项</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>backend</td><td></td><td>Must be set to <code>postgresql</code>.</td></tr><tr><td>serializer</td><td></td><td>Must be set to <code>postgresql</code>.</td></tr></tbody></table><p>其它与 MySQL 后端一致。</p><blockquote><p>PostgreSQL 后端的 driver 和 url 应该设置为:</p><ul><li><code>jdbc.driver=org.postgresql.Driver</code></li><li><code>jdbc.url=jdbc:postgresql://localhost:5432/</code></li></ul></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-7d189549d4201521c83e0d93a2474a2d>4.3 - HugeGraph 内置用户权限与扩展权限配置及使用</h1><h3 id=概述>概述</h3><p>HugeGraph 为了方便不同用户场景下的鉴权使用,目前内置了完备的<code>StandardAuthenticator</code>权限模式,支持多用户认证、
以及细粒度的权限访问控制,采用基于“用户 - 用户组 - 操作 - 资源”的 4 层设计,灵活控制用户角色与权限 (支持多 GraphServer)</p><p><code>StandardAuthenticator</code> 模式的几个核心设计:</p><ul><li>初始化时创建超级管理员 (<code>admin</code>) 用户,后续通过超级管理员创建其它用户,新创建的用户被分配足够权限后,可以创建或管理更多的用户</li><li>支持动态创建用户、用户组、资源,支持动态分配或取消权限</li><li>用户可以属于一个或多个用户组,每个用户组可以拥有对任意个资源的操作权限,操作类型包括:读、写、删除、执行等种类</li><li>&ldquo;资源&rdquo; 描述了图数据库中的数据,比如符合某一类条件的顶点,每一个资源包括 <code>type</code><code>label</code><code>properties</code>三个要素,共有 18 种类型、任意 label、任意 properties 可组合形成的资源,一个资源的内部条件是且关系,多个资源之间的条件是或关系</li></ul><p>举例说明:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 场景:某用户只有北京地区的数据读取权限
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>user</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>name</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>xx</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>belong</span><span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#000>group</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>name</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>xx</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>access</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>read</span><span style=color:#ce5c00;font-weight:700>)-&gt;</span> <span style=color:#000>target</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000>graph1</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>resource</span><span style=color:#ce5c00;font-weight:700>={</span><span style=color:#000>label</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>person</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>city</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>Beijing</span><span style=color:#ce5c00;font-weight:700>})</span>
</span></span></code></pre></div><h3 id=配置用户认证>配置用户认证</h3><p>HugeGraph 目前默认<strong>未启用</strong>用户认证功能,需通过修改配置文件来启用该功能。(Note: 如果在生产环境/外网使用,
请使用 <strong>Java11</strong> 版本 + 开启权限避免安全相关隐患)</p><p>目前已内置实现了<code>StandardAuthenticator</code>模式,该模式支持多用户认证与细粒度权限控制。此外,开发者可以自定义实现<code>HugeAuthenticator</code>接口来对接自身的权限系统。</p><p>用户认证方式均采用 <a href=https://zh.wikipedia.org/wiki/HTTP%E5%9F%BA%E6%9C%AC%E8%AE%A4%E8%AF%81>HTTP Basic Authentication</a> ,简单说就是在发送 HTTP 请求时在 <code>Authentication</code> 设置选择 <code>Basic</code> 然后输入对应的用户名和密码,对应 HTTP 明文如下所示 :</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-http data-lang=http><span style=display:flex><span><span style=color:#a40000>GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels
</span></span></span><span style=display:flex><span><span style=color:#a40000>Authorization: Basic admin xxxx
</span></span></span></code></pre></div><h4 id=standardauthenticator-模式>StandardAuthenticator 模式</h4><p><code>StandardAuthenticator</code>模式是通过在数据库后端存储用户信息来支持用户认证和权限控制,该实现基于数据库存储的用户的名称与密码进行认证(密码已被加密),基于用户的角色来细粒度控制用户权限。下面是具体的配置流程(重启服务生效):</p><p>在配置文件<code>gremlin-server.yaml</code>中配置<code>authenticator</code>及其<code>rest-server</code>文件路径:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>authentication</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>authenticator</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.auth.StandardAuthenticator,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>authenticationHandler</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.hugegraph.auth.WsAndHttpBasicAuthHandler,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#204a87;font-weight:700>tokens</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>conf/rest-server.properties}</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p>在配置文件<code>rest-server.properties</code>中配置<code>authenticator</code>及其<code>graph_store</code>信息:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
</span></span><span style=display:flex><span>auth.graph_store=hugegraph
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># auth client config
</span></span><span style=display:flex><span># 如果是分开部署 GraphServer 和 AuthServer,还需要指定下面的配置,地址填写 AuthServer 的 IP:RPC 端口
</span></span><span style=display:flex><span>#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897
</span></span></code></pre></div><p>其中,<code>graph_store</code>配置项是指使用哪一个图来存储用户信息,如果存在多个图的话,选取任意一个均可。</p><p>在配置文件<code>hugegraph{n}.properties</code>中配置<code>gremlin.graph</code>信息:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy
</span></span></code></pre></div><p>然后详细的权限 API 调用和说明请参考 <a href=/docs/clients/restful-api/auth>Authentication-API</a> 文档。</p><h3 id=自定义用户认证系统>自定义用户认证系统</h3><p>如果需要支持更加灵活的用户系统,可自定义 authenticator 进行扩展,自定义 authenticator 实现接口<code>org.apache.hugegraph.auth.HugeAuthenticator</code>即可,然后修改配置文件中<code>authenticator</code>配置项指向该实现。</p><h3 id=基于鉴权模式启动>基于鉴权模式启动</h3><p>在鉴权配置完成后,需在首次执行 <code>init-store.sh</code> 时命令行中输入 <code>admin</code> 密码 (非 docker 部署模式下)</p><p>如果基于 docker 镜像部署或者已经初始化 HugeGraph 并需要转换为鉴权模式,需要删除相关图数据并重新启动 HugeGraph, 若图已有业务数据,暂时<strong>无法直接转换</strong>鉴权模式 (hugegraph 版本 &lt;= 1.2.0)</p><blockquote><p>对于该功能的改进已经在最新版本发布 (Docker latest 可用),可参考 <a href=https://github.com/apache/incubator-hugegraph/pull/2411>PR 2411</a>, 此时可无缝切换。</p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># stop the hugeGraph firstly</span>
</span></span><span style=display:flex><span>bin/stop-hugegraph.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># delete the store data (here we use the default path for rocksdb)</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># Note: no need to delete data in the latest code (fixed in https://github.com/apache/incubator-hugegraph/pull/2411)</span>
</span></span><span style=display:flex><span>rm -rf rocksdb-data/
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># init store again</span>
</span></span><span style=display:flex><span>bin/init-store.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># start hugeGraph again</span>
</span></span><span style=display:flex><span>bin/start-hugegraph.sh
</span></span></code></pre></div><h3 id=使用-docker-时开启鉴权模式>使用 Docker 时开启鉴权模式</h3><p>对于镜像 <code>hugegraph/hugegraph</code> 大于等于 <code>1.2.0</code> 的版本,我们可以在启动 <code>docker</code> 镜像的同时开启鉴权模式</p><p>具体做法如下:</p><h4 id=1-采用-docker-run>1. 采用 docker run</h4><p><code>docker run</code> 中添加环境变量 <code>PASSWORD=123456</code>(密码可以自由设置)即可开启鉴权模式::</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker run -itd -e <span style=color:#000>PASSWORD</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>123456</span> --name<span style=color:#ce5c00;font-weight:700>=</span>server -p 8080:8080 hugegraph/hugegraph:1.2.0
</span></span></code></pre></div><h4 id=2-采用-docker-compose>2. 采用 docker-compose</h4><p>使用 <code>docker-compose</code> 在环境变量中设置 <code>PASSWORD=123456</code>即可</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#204a87;font-weight:700>version</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#4e9a06>&#39;3&#39;</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>services</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>server</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>image</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>hugegraph/hugegraph:1.2.0</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>container_name</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>server</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ports</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#0000cf;font-weight:700>8080</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8080</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>environment</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>- <span style=color:#000>PASSWORD=123456</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><h4 id=3-进入容器后重新开启鉴权模式>3. 进入容器后重新开启鉴权模式</h4><p>首先进入容器:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker <span style=color:#204a87>exec</span> -it server bash
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 用于快速修改配置, 修改前的文件被保存在conf-bak文件夹下</span>
</span></span><span style=display:flex><span>bin/enable-auth.sh
</span></span></code></pre></div><p>之后参照 <a href=#%E5%9F%BA%E4%BA%8E%E9%89%B4%E6%9D%83%E6%A8%A1%E5%BC%8F%E5%90%AF%E5%8A%A8>基于鉴权模式启动</a> 即可</p></div><div class=td-content style=page-break-before:always><h1 id=pg-7e400260398a18d0be72b1fe5a73f419>4.4 - 配置 HugeGraphServer 使用 https 协议</h1><h3 id=概述>概述</h3><p>HugeGraphServer 默认使用的是 http 协议,如果用户对请求的安全性有要求,可以配置成 https。</p><h3 id=服务端配置>服务端配置</h3><p>修改 conf/rest-server.properties 配置文件,将 restserver.url 的 schema 部分改为 https。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-ini data-lang=ini><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 将协议设置为 https</span>
</span></span><span style=display:flex><span><span style=color:#c4a000>restserver.url</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>https://127.0.0.1:8080</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 服务端 keystore 文件路径,当协议为 https 时该默认值自动生效,可按需修改此项</span>
</span></span><span style=display:flex><span><span style=color:#c4a000>ssl.keystore_file</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>conf/hugegraph-server.keystore</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 服务端 keystore 文件密码,当协议为 https 时该默认值自动生效,可按需修改此项</span>
</span></span><span style=display:flex><span><span style=color:#c4a000>ssl.keystore_password</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#4e9a06>******</span>
</span></span></code></pre></div><p>服务端的 conf 目录下已经给出了一个 keystore 文件<code>hugegraph-server.keystore</code>,该文件的密码为<code>hugegraph</code>
这两项都是在开启了 https 协议时的默认值,用户可以生成自己的 keystore 文件及密码,然后修改<code>ssl.keystore_file</code><code>ssl.keystore_password</code>的值。</p><h3 id=客户端配置>客户端配置</h3><h4 id=在-hugegraph-client-中使用-https>在 HugeGraph-Client 中使用 https</h4><p>在构造 HugeClient 时传入 https 相关的配置,代码示例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>String</span> <span style=color:#000>url</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;https://localhost:8080&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#000>String</span> <span style=color:#000>graphName</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#000>HugeClientBuilder</span> <span style=color:#000>builder</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>builder</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>url</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>graphName</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 客户端 keystore 文件路径
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>String</span> <span style=color:#000>trustStoreFilePath</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;hugegraph.truststore&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 客户端 keystore 密码
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>String</span> <span style=color:#000>trustStorePassword</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>configSSL</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>trustStoreFilePath</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>trustStorePassword</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#000>HugeClient</span> <span style=color:#000>hugeClient</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>builder</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>build</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><blockquote><p>注意:HugeGraph-Client 在 1.9.0 版本以前是直接以 new 的方式创建,并且不支持 https 协议,在 1.9.0 版本以后改成以 builder 的方式创建,并支持配置 https 协议。</p></blockquote><h4 id=在-hugegraph-loader-中使用-https>在 HugeGraph-Loader 中使用 https</h4><p>启动导入任务时,在命令行中添加如下选项:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># https</span>
</span></span><span style=display:flex><span>--protocol https
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 客户端证书文件路径,当指定 --protocol 为 https 时,默认值 conf/hugegraph.truststore 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--trust-store-file <span style=color:#ce5c00;font-weight:700>{</span>file<span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 客户端证书文件密码,当指定 --protocol 为 https 时,默认值 hugegraph 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--trust-store-password <span style=color:#ce5c00;font-weight:700>{</span>password<span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><p>hugegraph-loader 的 conf 目录下已经放了一个默认的客户端证书文件 hugegraph.truststore,其密码是 hugegraph。</p><h4 id=在-hugegraph-tools-中使用-https>在 HugeGraph-Tools 中使用 https</h4><p>执行命令时,在命令行中添加如下选项:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 客户端证书文件路径,当 url 中使用 https 协议时,默认值 conf/hugegraph.truststore 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--trust-store-file <span style=color:#ce5c00;font-weight:700>{</span>file<span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 客户端证书文件密码,当 url 中使用 https 协议时,默认值 hugegraph 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--trust-store-password <span style=color:#ce5c00;font-weight:700>{</span>password<span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 执行迁移命令时,当 --target-url 中使用 https 协议时,默认值 conf/hugegraph.truststore 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--target-trust-store-file <span style=color:#ce5c00;font-weight:700>{</span>target-file<span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 执行迁移命令时,当 --target-url 中使用 https 协议时,默认值 hugegraph 自动生效,可按需修改</span>
</span></span><span style=display:flex><span>--target-trust-store-password <span style=color:#ce5c00;font-weight:700>{</span>target-password<span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><p>hugegraph-tools 的 conf 目录下已经放了一个默认的客户端证书文件 hugegraph.truststore,其密码是 hugegraph。</p><h3 id=如何生成证书文件>如何生成证书文件</h3><p>本部分给出生成证书的示例,如果默认的证书已经够用,或者已经知晓如何生成,可跳过。</p><h4 id=服务端>服务端</h4><ol><li>⽣成服务端私钥,并且导⼊到服务端 keystore ⽂件中,server.keystore 是给服务端⽤的,其中保存着⾃⼰的私钥</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>keytool -genkey -alias serverkey -keyalg RSA -keystore server.keystore
</span></span></code></pre></div><p>过程中根据需求填写描述信息,默认证书的描述信息如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>名字和姓⽒:hugegraph
</span></span><span style=display:flex><span>组织单位名称:hugegraph
</span></span><span style=display:flex><span>组织名称:hugegraph
</span></span><span style=display:flex><span>城市或区域名称:BJ
</span></span><span style=display:flex><span>州或省份名称:BJ
</span></span><span style=display:flex><span>国家代码:CN
</span></span></code></pre></div><ol start=2><li>根据服务端私钥,导出服务端证书</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>keytool -export -alias serverkey -keystore server.keystore -file server.crt
</span></span></code></pre></div><p>server.crt 就是服务端的证书</p><h4 id=客户端>客户端</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>keytool -import -alias serverkey -file server.crt -keystore client.truststore
</span></span></code></pre></div><p>client.truststore 是给客户端⽤的,其中保存着受信任的证书</p></div><div class=td-content style=page-break-before:always><h1 id=pg-b22c66aa61d3c6e047af8286d3b5f445>4.5 - HugeGraph-Computer 配置</h1><h3 id=computer-config-options>Computer Config Options</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>algorithm.message_class</td><td>org.apache.hugegraph.computer.core.config.Null</td><td>The class of message passed when compute vertex.</td></tr><tr><td>algorithm.params_class</td><td>org.apache.hugegraph.computer.core.config.Null</td><td>The class used to transfer algorithms&rsquo; parameters before algorithm been run.</td></tr><tr><td>algorithm.result_class</td><td>org.apache.hugegraph.computer.core.config.Null</td><td>The class of vertex&rsquo;s value, the instance is used to store computation result for the vertex.</td></tr><tr><td>allocator.max_vertices_per_thread</td><td>10000</td><td>Maximum number of vertices per thread processed in each memory allocator</td></tr><tr><td>bsp.etcd_endpoints</td><td>http://localhost:2379</td><td>The end points to access etcd.</td></tr><tr><td>bsp.log_interval</td><td>30000</td><td>The log interval(in ms) to print the log while waiting bsp event.</td></tr><tr><td>bsp.max_super_step</td><td>10</td><td>The max super step of the algorithm.</td></tr><tr><td>bsp.register_timeout</td><td>300000</td><td>The max timeout to wait for master and works to register.</td></tr><tr><td>bsp.wait_master_timeout</td><td>86400000</td><td>The max timeout(in ms) to wait for master bsp event.</td></tr><tr><td>bsp.wait_workers_timeout</td><td>86400000</td><td>The max timeout to wait for workers bsp event.</td></tr><tr><td>hgkv.max_data_block_size</td><td>65536</td><td>The max byte size of hgkv-file data block.</td></tr><tr><td>hgkv.max_file_size</td><td>2147483648</td><td>The max number of bytes in each hgkv-file.</td></tr><tr><td>hgkv.max_merge_files</td><td>10</td><td>The max number of files to merge at one time.</td></tr><tr><td>hgkv.temp_file_dir</td><td>/tmp/hgkv</td><td>This folder is used to store temporary files, temporary files will be generated during the file merging process.</td></tr><tr><td>hugegraph.name</td><td>hugegraph</td><td>The graph name to load data and write results back.</td></tr><tr><td>hugegraph.url</td><td>http://127.0.0.1:8080</td><td>The hugegraph url to load data and write results back.</td></tr><tr><td>input.edge_direction</td><td>OUT</td><td>The data of the edge in which direction is loaded, when the value is BOTH, the edges in both OUT and IN direction will be loaded.</td></tr><tr><td>input.edge_freq</td><td>MULTIPLE</td><td>The frequency of edges can exist between a pair of vertices, allowed values: [SINGLE, SINGLE_PER_LABEL, MULTIPLE]. SINGLE means that only one edge can exist between a pair of vertices, use sourceId + targetId to identify it; SINGLE_PER_LABEL means that each edge label can exist one edge between a pair of vertices, use sourceId + edgelabel + targetId to identify it; MULTIPLE means that many edge can exist between a pair of vertices, use sourceId + edgelabel + sortValues + targetId to identify it.</td></tr><tr><td>input.filter_class</td><td>org.apache.hugegraph.computer.core.input.filter.DefaultInputFilter</td><td>The class to create input-filter object, input-filter is used to Filter vertex edges according to user needs.</td></tr><tr><td>input.loader_schema_path</td><td></td><td>The schema path of loader input, only takes effect when the input.source_type=loader is enabled</td></tr><tr><td>input.loader_struct_path</td><td></td><td>The struct path of loader input, only takes effect when the input.source_type=loader is enabled</td></tr><tr><td>input.max_edges_in_one_vertex</td><td>200</td><td>The maximum number of adjacent edges allowed to be attached to a vertex, the adjacent edges will be stored and transferred together as a batch unit.</td></tr><tr><td>input.source_type</td><td>hugegraph-server</td><td>The source type to load input data, allowed values: [&lsquo;hugegraph-server&rsquo;, &lsquo;hugegraph-loader&rsquo;], the &lsquo;hugegraph-loader&rsquo; means use hugegraph-loader load data from HDFS or file, if use &lsquo;hugegraph-loader&rsquo; load data then please config &lsquo;input.loader_struct_path&rsquo; and &lsquo;input.loader_schema_path&rsquo;.</td></tr><tr><td>input.split_fetch_timeout</td><td>300</td><td>The timeout in seconds to fetch input splits</td></tr><tr><td>input.split_max_splits</td><td>10000000</td><td>The maximum number of input splits</td></tr><tr><td>input.split_page_size</td><td>500</td><td>The page size for streamed load input split data</td></tr><tr><td>input.split_size</td><td>1048576</td><td>The input split size in bytes</td></tr><tr><td>job.id</td><td>local_0001</td><td>The job id on Yarn cluster or K8s cluster.</td></tr><tr><td>job.partitions_count</td><td>1</td><td>The partitions count for computing one graph algorithm job.</td></tr><tr><td>job.partitions_thread_nums</td><td>4</td><td>The number of threads for partition parallel compute.</td></tr><tr><td>job.workers_count</td><td>1</td><td>The workers count for computing one graph algorithm job.</td></tr><tr><td>master.computation_class</td><td>org.apache.hugegraph.computer.core.master.DefaultMasterComputation</td><td>Master-computation is computation that can determine whether to continue next superstep. It runs at the end of each superstep on master.</td></tr><tr><td>output.batch_size</td><td>500</td><td>The batch size of output</td></tr><tr><td>output.batch_threads</td><td>1</td><td>The threads number used to batch output</td></tr><tr><td>output.hdfs_core_site_path</td><td></td><td>The hdfs core site path.</td></tr><tr><td>output.hdfs_delimiter</td><td>,</td><td>The delimiter of hdfs output.</td></tr><tr><td>output.hdfs_kerberos_enable</td><td>false</td><td>Is Kerberos authentication enabled for Hdfs.</td></tr><tr><td>output.hdfs_kerberos_keytab</td><td></td><td>The Hdfs&rsquo;s key tab file for kerberos authentication.</td></tr><tr><td>output.hdfs_kerberos_principal</td><td></td><td>The Hdfs&rsquo;s principal for kerberos authentication.</td></tr><tr><td>output.hdfs_krb5_conf</td><td>/etc/krb5.conf</td><td>Kerberos configuration file.</td></tr><tr><td>output.hdfs_merge_partitions</td><td>true</td><td>Whether merge output files of multiple partitions.</td></tr><tr><td>output.hdfs_path_prefix</td><td>/hugegraph-computer/results</td><td>The directory of hdfs output result.</td></tr><tr><td>output.hdfs_replication</td><td>3</td><td>The replication number of hdfs.</td></tr><tr><td>output.hdfs_site_path</td><td></td><td>The hdfs site path.</td></tr><tr><td>output.hdfs_url</td><td>hdfs://127.0.0.1:9000</td><td>The hdfs url of output.</td></tr><tr><td>output.hdfs_user</td><td>hadoop</td><td>The hdfs user of output.</td></tr><tr><td>output.output_class</td><td>org.apache.hugegraph.computer.core.output.LogOutput</td><td>The class to output the computation result of each vertex. Be called after iteration computation.</td></tr><tr><td>output.result_name</td><td>value</td><td>The value is assigned dynamically by #name() of instance created by WORKER_COMPUTATION_CLASS.</td></tr><tr><td>output.result_write_type</td><td>OLAP_COMMON</td><td>The result write-type to output to hugegraph, allowed values are: [OLAP_COMMON, OLAP_SECONDARY, OLAP_RANGE].</td></tr><tr><td>output.retry_interval</td><td>10</td><td>The retry interval when output failed</td></tr><tr><td>output.retry_times</td><td>3</td><td>The retry times when output failed</td></tr><tr><td>output.single_threads</td><td>1</td><td>The threads number used to single output</td></tr><tr><td>output.thread_pool_shutdown_timeout</td><td>60</td><td>The timeout seconds of output threads pool shutdown</td></tr><tr><td>output.with_adjacent_edges</td><td>false</td><td>Output the adjacent edges of the vertex or not</td></tr><tr><td>output.with_edge_properties</td><td>false</td><td>Output the properties of the edge or not</td></tr><tr><td>output.with_vertex_properties</td><td>false</td><td>Output the properties of the vertex or not</td></tr><tr><td>sort.thread_nums</td><td>4</td><td>The number of threads performing internal sorting.</td></tr><tr><td>transport.client_connect_timeout</td><td>3000</td><td>The timeout(in ms) of client connect to server.</td></tr><tr><td>transport.client_threads</td><td>4</td><td>The number of transport threads for client.</td></tr><tr><td>transport.close_timeout</td><td>10000</td><td>The timeout(in ms) of close server or close client.</td></tr><tr><td>transport.finish_session_timeout</td><td>0</td><td>The timeout(in ms) to finish session, 0 means using (transport.sync_request_timeout * transport.max_pending_requests).</td></tr><tr><td>transport.heartbeat_interval</td><td>20000</td><td>The minimum interval(in ms) between heartbeats on client side.</td></tr><tr><td>transport.io_mode</td><td>AUTO</td><td>The network IO Mode, either &lsquo;NIO&rsquo;, &lsquo;EPOLL&rsquo;, &lsquo;AUTO&rsquo;, the &lsquo;AUTO&rsquo; means selecting the property mode automatically.</td></tr><tr><td>transport.max_pending_requests</td><td>8</td><td>The max number of client unreceived ack, it will trigger the sending unavailable if the number of unreceived ack >= max_pending_requests.</td></tr><tr><td>transport.max_syn_backlog</td><td>511</td><td>The capacity of SYN queue on server side, 0 means using system default value.</td></tr><tr><td>transport.max_timeout_heartbeat_count</td><td>120</td><td>The maximum times of timeout heartbeat on client side, if the number of timeouts waiting for heartbeat response continuously > max_heartbeat_timeouts the channel will be closed from client side.</td></tr><tr><td>transport.min_ack_interval</td><td>200</td><td>The minimum interval(in ms) of server reply ack.</td></tr><tr><td>transport.min_pending_requests</td><td>6</td><td>The minimum number of client unreceived ack, it will trigger the sending available if the number of unreceived ack &lt; min_pending_requests.</td></tr><tr><td>transport.network_retries</td><td>3</td><td>The number of retry attempts for network communication,if network unstable.</td></tr><tr><td>transport.provider_class</td><td>org.apache.hugegraph.computer.core.network.netty.NettyTransportProvider</td><td>The transport provider, currently only supports Netty.</td></tr><tr><td>transport.receive_buffer_size</td><td>0</td><td>The size of socket receive-buffer in bytes, 0 means using system default value.</td></tr><tr><td>transport.recv_file_mode</td><td>true</td><td>Whether enable receive buffer-file mode, it will receive buffer write file from socket by zero-copy if enable.</td></tr><tr><td>transport.send_buffer_size</td><td>0</td><td>The size of socket send-buffer in bytes, 0 means using system default value.</td></tr><tr><td>transport.server_host</td><td>127.0.0.1</td><td>The server hostname or ip to listen on to transfer data.</td></tr><tr><td>transport.server_idle_timeout</td><td>360000</td><td>The max timeout(in ms) of server idle.</td></tr><tr><td>transport.server_port</td><td>0</td><td>The server port to listen on to transfer data. The system will assign a random port if it&rsquo;s set to 0.</td></tr><tr><td>transport.server_threads</td><td>4</td><td>The number of transport threads for server.</td></tr><tr><td>transport.sync_request_timeout</td><td>10000</td><td>The timeout(in ms) to wait response after sending sync-request.</td></tr><tr><td>transport.tcp_keep_alive</td><td>true</td><td>Whether enable TCP keep-alive.</td></tr><tr><td>transport.transport_epoll_lt</td><td>false</td><td>Whether enable EPOLL level-trigger.</td></tr><tr><td>transport.write_buffer_high_mark</td><td>67108864</td><td>The high water mark for write buffer in bytes, it will trigger the sending unavailable if the number of queued bytes > write_buffer_high_mark.</td></tr><tr><td>transport.write_buffer_low_mark</td><td>33554432</td><td>The low water mark for write buffer in bytes, it will trigger the sending available if the number of queued bytes &lt; write_buffer_low_mark.org.apache.hugegraph.config.OptionChecker$$Lambda$97/0x00000008001c8440@776a6d9b</td></tr><tr><td>transport.write_socket_timeout</td><td>3000</td><td>The timeout(in ms) to write data to socket buffer.</td></tr><tr><td>valuefile.max_segment_size</td><td>1073741824</td><td>The max number of bytes in each segment of value-file.</td></tr><tr><td>worker.combiner_class</td><td>org.apache.hugegraph.computer.core.config.Null</td><td>Combiner can combine messages into one value for a vertex, for example page-rank algorithm can combine messages of a vertex to a sum value.</td></tr><tr><td>worker.computation_class</td><td>org.apache.hugegraph.computer.core.config.Null</td><td>The class to create worker-computation object, worker-computation is used to compute each vertex in each superstep.</td></tr><tr><td>worker.data_dirs</td><td>[jobs]</td><td>The directories separated by &lsquo;,&rsquo; that received vertices and messages can persist into.</td></tr><tr><td>worker.edge_properties_combiner_class</td><td>org.apache.hugegraph.computer.core.combiner.OverwritePropertiesCombiner</td><td>The combiner can combine several properties of the same edge into one properties at inputstep.</td></tr><tr><td>worker.partitioner</td><td>org.apache.hugegraph.computer.core.graph.partition.HashPartitioner</td><td>The partitioner that decides which partition a vertex should be in, and which worker a partition should be in.</td></tr><tr><td>worker.received_buffers_bytes_limit</td><td>104857600</td><td>The limit bytes of buffers of received data, the total size of all buffers can&rsquo;t excess this limit. If received buffers reach this limit, they will be merged into a file.</td></tr><tr><td>worker.vertex_properties_combiner_class</td><td>org.apache.hugegraph.computer.core.combiner.OverwritePropertiesCombiner</td><td>The combiner can combine several properties of the same vertex into one properties at inputstep.</td></tr><tr><td>worker.wait_finish_messages_timeout</td><td>86400000</td><td>The max timeout(in ms) message-handler wait for finish-message of all workers.</td></tr><tr><td>worker.wait_sort_timeout</td><td>600000</td><td>The max timeout(in ms) message-handler wait for sort-thread to sort one batch of buffers.</td></tr><tr><td>worker.write_buffer_capacity</td><td>52428800</td><td>The initial size of write buffer that used to store vertex or message.</td></tr><tr><td>worker.write_buffer_threshold</td><td>52428800</td><td>The threshold of write buffer, exceeding it will trigger sorting, the write buffer is used to store vertex or message.</td></tr></tbody></table><h3 id=k8s-operator-config-options>K8s Operator Config Options</h3><blockquote><p>NOTE: Option needs to be converted through environment variable settings, e.g. k8s.internal_etcd_url => INTERNAL_ETCD_URL</p></blockquote><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>k8s.auto_destroy_pod</td><td>true</td><td>Whether to automatically destroy all pods when the job is completed or failed.</td></tr><tr><td>k8s.close_reconciler_timeout</td><td>120</td><td>The max timeout(in ms) to close reconciler.</td></tr><tr><td>k8s.internal_etcd_url</td><td>http://127.0.0.1:2379</td><td>The internal etcd url for operator system.</td></tr><tr><td>k8s.max_reconcile_retry</td><td>3</td><td>The max retry times of reconcile.</td></tr><tr><td>k8s.probe_backlog</td><td>50</td><td>The maximum backlog for serving health probes.</td></tr><tr><td>k8s.probe_port</td><td>9892</td><td>The value is the port that the controller bind to for serving health probes.</td></tr><tr><td>k8s.ready_check_internal</td><td>1000</td><td>The time interval(ms) of check ready.</td></tr><tr><td>k8s.ready_timeout</td><td>30000</td><td>The max timeout(in ms) of check ready.</td></tr><tr><td>k8s.reconciler_count</td><td>10</td><td>The max number of reconciler thread.</td></tr><tr><td>k8s.resync_period</td><td>600000</td><td>The minimum frequency at which watched resources are reconciled.</td></tr><tr><td>k8s.timezone</td><td>Asia/Shanghai</td><td>The timezone of computer job and operator.</td></tr><tr><td>k8s.watch_namespace</td><td>hugegraph-computer-system</td><td>The value is watch custom resources in the namespace, ignore other namespaces, the &lsquo;*&rsquo; means is all namespaces will be watched.</td></tr></tbody></table><h3 id=hugegraph-computer-crd>HugeGraph-Computer CRD</h3><blockquote><p>CRD: <a href=https://github.com/apache/hugegraph-computer/blob/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1.yaml>https://github.com/apache/hugegraph-computer/blob/master/computer-k8s-operator/manifest/hugegraph-computer-crd.v1.yaml</a></p></blockquote><table><thead><tr><th>spec</th><th>default value</th><th>description</th><th>required</th></tr></thead><tbody><tr><td>algorithmName</td><td></td><td>The name of algorithm.</td><td>true</td></tr><tr><td>jobId</td><td></td><td>The job id.</td><td>true</td></tr><tr><td>image</td><td></td><td>The image of algorithm.</td><td>true</td></tr><tr><td>computerConf</td><td></td><td>The map of computer config options.</td><td>true</td></tr><tr><td>workerInstances</td><td></td><td>The number of worker instances, it will instead the &lsquo;job.workers_count&rsquo; option.</td><td>true</td></tr><tr><td>pullPolicy</td><td>Always</td><td>The pull-policy of image, detail please refer to: <a href=https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy>https://kubernetes.io/docs/concepts/containers/images/#image-pull-policy</a></td><td>false</td></tr><tr><td>pullSecrets</td><td></td><td>The pull-secrets of Image, detail please refer to: <a href=https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod>https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod</a></td><td>false</td></tr><tr><td>masterCpu</td><td></td><td>The cpu limit of master, the unit can be &rsquo;m&rsquo; or without unit detail please refer to:<a href=https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu>https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu</a></td><td>false</td></tr><tr><td>workerCpu</td><td></td><td>The cpu limit of worker, the unit can be &rsquo;m&rsquo; or without unit detail please refer to:<a href=https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu>https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu</a></td><td>false</td></tr><tr><td>masterMemory</td><td></td><td>The memory limit of master, the unit can be one of Ei、Pi、Ti、Gi、Mi、Ki detail please refer to:<a href=https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory>https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory</a></td><td>false</td></tr><tr><td>workerMemory</td><td></td><td>The memory limit of worker, the unit can be one of Ei、Pi、Ti、Gi、Mi、Ki detail please refer to:<a href=https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory>https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-memory</a></td><td>false</td></tr><tr><td>log4jXml</td><td></td><td>The content of log4j.xml for computer job.</td><td>false</td></tr><tr><td>jarFile</td><td></td><td>The jar path of computer algorithm.</td><td>false</td></tr><tr><td>remoteJarUri</td><td></td><td>The remote jar uri of computer algorithm, it will overlay algorithm image.</td><td>false</td></tr><tr><td>jvmOptions</td><td></td><td>The java startup parameters of computer job.</td><td>false</td></tr><tr><td>envVars</td><td></td><td>please refer to: <a href=https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/>https://kubernetes.io/docs/tasks/inject-data-application/define-interdependent-environment-variables/</a></td><td>false</td></tr><tr><td>envFrom</td><td></td><td>please refer to: <a href=https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/>https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/</a></td><td>false</td></tr><tr><td>masterCommand</td><td>bin/start-computer.sh</td><td>The run command of master, equivalent to &lsquo;Entrypoint&rsquo; field of Docker.</td><td>false</td></tr><tr><td>masterArgs</td><td>["-r master", &ldquo;-d k8s&rdquo;]</td><td>The run args of master, equivalent to &lsquo;Cmd&rsquo; field of Docker.</td><td>false</td></tr><tr><td>workerCommand</td><td>bin/start-computer.sh</td><td>The run command of worker, equivalent to &lsquo;Entrypoint&rsquo; field of Docker.</td><td>false</td></tr><tr><td>workerArgs</td><td>["-r worker", &ldquo;-d k8s&rdquo;]</td><td>The run args of worker, equivalent to &lsquo;Cmd&rsquo; field of Docker.</td><td>false</td></tr><tr><td>volumes</td><td></td><td>Please refer to: <a href=https://kubernetes.io/docs/concepts/storage/volumes/>https://kubernetes.io/docs/concepts/storage/volumes/</a></td><td>false</td></tr><tr><td>volumeMounts</td><td></td><td>Please refer to: <a href=https://kubernetes.io/docs/concepts/storage/volumes/>https://kubernetes.io/docs/concepts/storage/volumes/</a></td><td>false</td></tr><tr><td>secretPaths</td><td></td><td>The map of k8s-secret name and mount path.</td><td>false</td></tr><tr><td>configMapPaths</td><td></td><td>The map of k8s-configmap name and mount path.</td><td>false</td></tr><tr><td>podTemplateSpec</td><td></td><td>Please refer to: <a href=https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-template-v1/#PodTemplateSpec>https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-template-v1/#PodTemplateSpec</a></td><td>false</td></tr><tr><td>securityContext</td><td></td><td>Please refer to: <a href=https://kubernetes.io/docs/tasks/configure-pod-container/security-context/>https://kubernetes.io/docs/tasks/configure-pod-container/security-context/</a></td><td>false</td></tr></tbody></table><h3 id=kubedriver-config-options>KubeDriver Config Options</h3><table><thead><tr><th>config option</th><th>default value</th><th>description</th></tr></thead><tbody><tr><td>k8s.build_image_bash_path</td><td></td><td>The path of command used to build image.</td></tr><tr><td>k8s.enable_internal_algorithm</td><td>true</td><td>Whether enable internal algorithm.</td></tr><tr><td>k8s.framework_image_url</td><td>hugegraph/hugegraph-computer:latest</td><td>The image url of computer framework.</td></tr><tr><td>k8s.image_repository_password</td><td></td><td>The password for login image repository.</td></tr><tr><td>k8s.image_repository_registry</td><td></td><td>The address for login image repository.</td></tr><tr><td>k8s.image_repository_url</td><td>hugegraph/hugegraph-computer</td><td>The url of image repository.</td></tr><tr><td>k8s.image_repository_username</td><td></td><td>The username for login image repository.</td></tr><tr><td>k8s.internal_algorithm</td><td>[pageRank]</td><td>The name list of all internal algorithm.</td></tr><tr><td>k8s.internal_algorithm_image_url</td><td>hugegraph/hugegraph-computer:latest</td><td>The image url of internal algorithm.</td></tr><tr><td>k8s.jar_file_dir</td><td>/cache/jars/</td><td>The directory where the algorithm jar to upload location.</td></tr><tr><td>k8s.kube_config</td><td>~/.kube/config</td><td>The path of k8s config file.</td></tr><tr><td>k8s.log4j_xml_path</td><td></td><td>The log4j.xml path for computer job.</td></tr><tr><td>k8s.namespace</td><td>hugegraph-computer-system</td><td>The namespace of hugegraph-computer system.</td></tr><tr><td>k8s.pull_secret_names</td><td>[]</td><td>The names of pull-secret for pulling image.</td></tr></tbody></table></div><div class=td-content style=page-break-before:always><h1 id=pg-8f8368cdf9ec684d30761c6d28a34179>5 - API</h1></div><div class=td-content><h1 id=pg-a809bf70d5493b5046619919800e4de6>5.1 - HugeGraph RESTful API</h1><p>HugeGraph-Server通过HugeGraph-API基于HTTP协议为Client提供操作图的接口,主要包括元数据和
图数据的增删改查,遍历算法,变量,图操作及其他操作。</p><p>除了下方的文档,你还可以通过 <code>localhost:8080/swagger-ui/index.html</code> 访问 <code>swagger-ui</code> 以查看 <code>RESTful API</code><a href=/cn/docs/quickstart/hugegraph-server#swaggerui-example>示例可以参考此处</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-698c3217de07a8cb0dc0e93dbae29ee9>5.1.1 - Schema API</h1><h3 id=11-schema>1.1 Schema</h3><p>HugeGraph 提供单一接口获取某个图的全部 Schema 信息,包括:PropertyKey、VertexLabel、EdgeLabel 和 IndexLabel。</p><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph_name}/schema
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>e.g: GET http://localhost:8080/graphs/hugegraph/schema
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;propertykeys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.316&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.309&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.287&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.280&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.301&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.294&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.250&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertexlabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.336&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CUSTOMIZE_NUMBER&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;softwareByPrice&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;price&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.347&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edgelabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;knowsByWeight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:08.437&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;createdByWeight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:08.446&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;indexlabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RANGE_INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:05.375&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:06.898&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:07.407&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RANGE_DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;price&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:07.916&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;EDGE_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:08.454&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;createdByWeight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;EDGE_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RANGE_DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:08.963&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knowsByWeight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;EDGE_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RANGE_DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2023-05-08 17:49:09.473&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-f7f4b3b6f4b7a965f8c30675df8e56f8>5.1.2 - PropertyKey API</h1><h3 id=12-propertykey>1.2 PropertyKey</h3><p>Params说明:</p><ul><li>name:属性类型名称,必填</li><li>data_type:属性类型数据类型,包括:bool、byte、int、long、float、double、string、date、uuid、blob,默认string类型</li><li>cardinality:属性类型基数,包括:single、list、set,默认single</li></ul><p>请求体字段说明:</p><ul><li>id:属性类型id值</li><li>properties:属性的属性,对于属性而言,此项为空</li><li>user_data:设置属性类型的通用信息,比如可设置age属性的取值范围,最小为0,最大为100;目前此项不做任何校验,只为后期拓展提供预留入口</li></ul><h4 id=121-创建一个-propertykey>1.2.1 创建一个 PropertyKey</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/schema/propertykeys
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;property_key&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2022-05-13 13:47:23.745&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=122-为已存在的-propertykey-添加或移除-userdata>1.2.2 为已存在的 PropertyKey 添加或移除 userdata</h4><h5 id=params>Params</h5><ul><li>action: 表示当前行为是添加还是移除,取值为<code>append</code>(添加)和<code>eliminate</code>(移除)</li></ul><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/schema/propertykeys/age?action=append
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;property_key&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2022-05-13 13:47:23.745&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=123-获取所有的-propertykey>1.2.3 获取所有的 PropertyKey</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/propertykeys
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;propertykeys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DOUBLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=124-根据name获取propertykey>1.2.4 根据name获取PropertyKey</h4><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/propertykeys/age
</span></span></code></pre></div><p>其中,<code>age</code>为要获取的 PropertyKey 的名称</p><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;INT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cardinality&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aggregate_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;write_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CREATED&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;~create_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2022-05-13 13:47:23.745&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=125-根据-name-删除-propertykey>1.2.5 根据 name 删除 PropertyKey</h4><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/schema/propertykeys/age
</span></span></code></pre></div><p>其中,<code>age</code>为要删除的 PropertyKey 的名称</p><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span> <span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-28cb205879be97a55ddc8cd365c4438e>5.1.3 - VertexLabel API</h1><h3 id=13-vertexlabel>1.3 VertexLabel</h3><p>假设已经创建好了1.1.3中列出来的 PropertyKeys</p><p>Params说明</p><ul><li>id:顶点类型id值</li><li>name:顶点类型名称,必填</li><li>id_strategy: 顶点类型的ID策略,主键ID、自动生成、自定义字符串、自定义数字、自定义UUID,默认主键ID</li><li>properties: 顶点类型关联的属性类型</li><li>primary_keys: 主键属性,当ID策略为PRIMARY_KEY时必须有值,其他ID策略时必须为空;</li><li>enable_label_index: 是否开启类型索引,默认关闭</li><li>index_names:顶点类型创建的索引,详情见3.4</li><li>nullable_keys:可为空的属性</li><li>user_data:设置顶点类型的通用信息,作用同属性类型</li></ul><h4 id=131-创建一个vertexlabel>1.3.1 创建一个VertexLabel</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/schema/vertexlabels
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DEFAULT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>从 hugegraph-server v0.11.2 版本开始支持顶点的 TTL 功能。顶点的 TTL 是通过 VertexLabel 来设置的。比如希望 person 类型的顶点存活时间为一天,需要在创建 person VertexLabel 的时候将 TTL 字段设置为 86400000,即单位为毫秒。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DEFAULT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>86400000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>另外,当顶点中带有"创建时间"的属性且希望以"创建时间"属性作为计算顶点存活时间的起点时,可以设置 VertexLabel 中的 ttl_start_time 字段。比如 person VertexLabel 有 createdTime 属性,且 createdTime 是 Date 类型的参数,希望 person 类型的顶点从创建开始存活一天的时间,那么创建 person VertexLabel 的 Request Body 如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;DEFAULT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;createdTime&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>86400000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl_start_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;createdTime&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=132-为已存在的vertexlabel添加properties或userdata或者移除userdata目前不支持移除properties>1.3.2 为已存在的VertexLabel添加properties或userdata,或者移除userdata(目前不支持移除properties)</h4><h5 id=params>Params</h5><ul><li>action: 表示当前行为是添加还是移除,取值为<code>append</code>(添加)和<code>eliminate</code>(移除)</li></ul><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/schema/vertexlabels/person?action=append
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;super&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;animal&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;super&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;animal&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=133-获取所有的vertexlabel>1.3.3 获取所有的VertexLabel</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertexlabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;super&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;animal&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;price&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=134-根据name获取vertexlabel>1.3.4 根据name获取VertexLabel</h4><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels/person
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;primary_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id_strategy&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;PRIMARY_KEY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;super&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;animal&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=135-根据name删除vertexlabel>1.3.5 根据name删除VertexLabel</h4><p>删除 VertexLabel 会导致删除对应的顶点以及相关的索引数据,会产生一个异步任务</p><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/schema/vertexlabels/person
</span></span></code></pre></div><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/1</code>(其中"1"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-41864d99c39fc7040549f6eaf5441daf>5.1.4 - EdgeLabel API</h1><h3 id=14-edgelabel>1.4 EdgeLabel</h3><p>假设已经创建好了1.2.3中的 PropertyKeys 和 1.3.3中的 VertexLabels</p><p>Params说明</p><ul><li>name:顶点类型名称,必填</li><li>source_label: 源顶点类型的名称,必填</li><li>target_label: 目标顶点类型的名称,必填</li><li>frequency:两个点之间是否可以有多条边,可以取值SINGLE和MULTIPLE,非必填,默认值SINGLE</li><li>properties: 边类型关联的属性类型,选填</li><li>sort_keys: 当允许关联多次时,指定区分键属性列表</li><li>nullable_keys:可为空的属性,选填,默认可为空</li><li>enable_label_index: 是否开启类型索引,默认关闭</li></ul><h4 id=141-创建一个edgelabel>1.4.1 创建一个EdgeLabel</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/schema/edgelabels
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>从 hugegraph-server v0.11.2 版本开始支持边的 TTL 功能。边的 TTL 是通过 EdgeLabel 来设置的。比如希望 knows 类型的边存活时间为一天,需要在创建 knows EdgeLabel 的时候将 TTL 字段设置为 86400000,即单位为毫秒。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;createdTime&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>86400000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>另外,当边中带有"创建时间"的属性且希望以"创建时间"属性作为计算边存活时间的起点时,可以设置 EdgeLabel 中的 ttl_start_time 字段。比如 knows EdgeLabel 有 createdTime 属性,且 createdTime 是 Date 类型的参数,希望 knows 类型的边从创建开始存活一天的时间,那么创建 knows EdgeLabel 的 Request Body 如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;createdTime&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>86400000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ttl_start_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;createdTime&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=142-为已存在的edgelabel添加properties或userdata或者移除userdata目前不支持移除properties>1.4.2 为已存在的EdgeLabel添加properties或userdata,或者移除userdata(目前不支持移除properties)</h4><h5 id=params>Params</h5><ul><li>action: 表示当前行为是添加还是移除,取值为<code>append</code>(添加)和<code>eliminate</code>(移除)</li></ul><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/schema/edgelabels/created?action=append
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=143-获取所有的edgelabel>1.4.3 获取所有的EdgeLabel</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/edgelabels
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edgelabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=144-根据name获取edgelabel>1.4.4 根据name获取EdgeLabel</h4><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/edgelabels/created
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_names&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;frequency&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SINGLE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nullable_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;weight&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;enable_label_index&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=145-根据name删除edgelabel>1.4.5 根据name删除EdgeLabel</h4><p>删除 EdgeLabel 会导致删除对应的边以及相关的索引数据,会产生一个异步任务</p><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/schema/edgelabels/created
</span></span></code></pre></div><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/1</code>(其中"1"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-7099742fb947ad5dfde9e72216c10b8a>5.1.5 - IndexLabel API</h1><h3 id=15-indexlabel>1.5 IndexLabel</h3><p>假设已经创建好了1.1.3中的 PropertyKeys 、1.2.3中的 VertexLabels 以及 1.3.3中的 EdgeLabels</p><h4 id=151-创建一个indexlabel>1.5.1 创建一个IndexLabel</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/schema/indexlabels
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=152-获取所有的indexlabel>1.5.2 获取所有的IndexLabel</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/indexlabels
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;indexlabels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;price&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RANGE&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;EDGE_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;date&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=153-根据name获取indexlabel>1.5.3 根据name获取IndexLabel</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;VERTEX_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;base_value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;fields&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;city&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;index_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SECONDARY&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=154-根据name删除indexlabel>1.5.4 根据name删除IndexLabel</h4><p>删除 IndexLabel 会导致删除相关的索引数据,会产生一个异步任务</p><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/1</code>(其中"1"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-bde129922f801ad9560757fcec64d05c>5.1.6 - Rebuild API</h1><h3 id=16-rebuild>1.6 Rebuild</h3><h4 id=161-重建indexlabel>1.6.1 重建IndexLabel</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/jobs/rebuild/indexlabels/personByCity
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/1</code>(其中"1"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote><h4 id=162-vertexlabel对应的全部索引重建>1.6.2 VertexLabel对应的全部索引重建</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/jobs/rebuild/vertexlabels/person
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/2</code>(其中"2"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote><h4 id=163-edgelabel对应的全部索引重建>1.6.3 EdgeLabel对应的全部索引重建</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/jobs/rebuild/edgelabels/created
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/3</code>(其中"3"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-86bf520fd6b098231f4af6590328e871>5.1.7 - Vertex API</h1><h3 id=21-vertex>2.1 Vertex</h3><p>顶点类型中的 <code>Id</code> 策略决定了顶点的 <code>Id</code> 类型,其对应的 <code>id</code> 类型如下:</p><table><thead><tr><th>Id_Strategy</th><th>id type</th></tr></thead><tbody><tr><td>AUTOMATIC</td><td>number</td></tr><tr><td>PRIMARY_KEY</td><td>string</td></tr><tr><td>CUSTOMIZE_STRING</td><td>string</td></tr><tr><td>CUSTOMIZE_NUMBER</td><td>number</td></tr><tr><td>CUSTOMIZE_UUID</td><td>uuid</td></tr></tbody></table><p>顶点的 <code>GET/PUT/DELETE</code> API 中 url 的 id 部分应该传入带有类型信息的 id 值,这个类型信息通过 json 串是否带引号来表示,也就是说:</p><ul><li>当 id 类型为 <code>number</code> 时,url 中的 id 不带引号,例如 <code>xxx/vertices/123456</code></li><li>当 id 类型为 <code>string</code> 时,url 中的 id 带引号,例如 <code>xxx/vertices/"123456"</code></li></ul><hr><p>接下来的示例需要先根据以下 <code>groovy</code> 脚本创建图 <code>schema</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;hobby&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>valueList</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hobby&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hobby&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h4 id=211-创建一个顶点>2.1.1 创建一个顶点</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/graph/vertices
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=212-创建多个顶点>2.1.2 创建多个顶点</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/graph/vertices/batch
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>]</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>]</span>
</span></span></code></pre></div><h4 id=213-更新顶点属性>2.1.3 更新顶点属性</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/&#34;1:marko&#34;?action=append
</span></span></code></pre></div><h5 id=request-body-2>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>注意:属性的取值有三种类别,分别为single、set和list。single表示增加或更新属性值,set或list表示追加属性值。</p></blockquote><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=214-批量更新顶点属性>2.1.4 批量更新顶点属性</h4><h5 id=功能说明>功能说明</h5><p>批量更新顶点的属性时,可以选择多种更新策略,如下:</p><ul><li>SUM: 数值累加</li><li>BIGGER: 原值和新值(数字、日期)取更大的</li><li>SMALLER: 原值和新值(数字、日期)取更小的</li><li>UNION: Set属性取并集</li><li>INTERSECTION: Set属性取交集</li><li>APPEND: List属性追加元素</li><li>ELIMINATE: List/Set属性删除元素</li><li>OVERRIDE: 覆盖已有属性,如果新属性为null,则仍然使用旧属性</li></ul><p>假设原顶点的属性如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hobby&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;reading&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;football&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>通过以下命令新增顶点:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>curl -H <span style=color:#4e9a06>&#34;Content-Type: application/json&#34;</span> -d <span style=color:#4e9a06>&#39;[{&#34;label&#34;:&#34;person&#34;,&#34;properties&#34;:{&#34;name&#34;:&#34;josh&#34;,&#34;age&#34;:32,&#34;city&#34;:&#34;Beijing&#34;,&#34;weight&#34;:0.1,&#34;hobby&#34;:[&#34;reading&#34;,&#34;football&#34;]}},{&#34;label&#34;:&#34;software&#34;,&#34;properties&#34;:{&#34;name&#34;:&#34;lop&#34;,&#34;lang&#34;:&#34;java&#34;,&#34;price&#34;:328}}]&#39;</span> http:///127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch
</span></span></code></pre></div><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/batch
</span></span></code></pre></div><h5 id=request-body-3>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;c++&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>299</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hobby&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;swimming&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BIGGER&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OVERRIDE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OVERRIDE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SUM&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hobby&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;UNION&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;create_if_not_exist&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;c++&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hobby&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;reading&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;football&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;swimming&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>结果分析如下:</p><ul><li>lang 属性未指定更新策略,直接用新值覆盖旧值,无论新值是否为null;</li><li>price 属性指定 BIGGER 的更新策略,旧属性值为328,新属性值为299,所以仍然保留了旧属性值328;</li><li>age 属性指定 OVERRIDE 更新策略,而新属性值中未传入age,相当于age为null,所以仍然保留了原属性值32;</li><li>city 属性也指定了 OVERRIDE 更新策略,且新属性值不为null,所以覆盖了旧值;</li><li>weight 属性指定了 SUM 更新策略,旧属性值为0.1,新属性值为0.2,最后的值为0.3;</li><li>hobby 属性(基数为Set)指定了 UNION 更新策略,所以新值与旧值取了并集;</li></ul><p>其他更新策略的使用方式与此类似,此处不再详述。</p><h4 id=215-删除顶点属性>2.1.5 删除顶点属性</h4><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://127.0.0.1:8080/graphs/hugegraph/graph/vertices/&#34;1:marko&#34;?action=eliminate
</span></span></code></pre></div><h5 id=request-body-4>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>注意:这里会直接删除属性(删除key和所有value),无论其属性的取值是single、set或list。</p></blockquote><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=216-获取符合条件的顶点>2.1.6 获取符合条件的顶点</h4><h5 id=params>Params</h5><ul><li>label: 顶点的类型</li><li>properties: 属性键值对(查询属性的前提是该属性已经建立了索引)</li><li>limit: 查询结果的最大数目</li><li>page: 分页的页号</li></ul><p>以上参数都是可选的,但如果提供了page参数,就必须同时提供limit参数,并且不能再提供其他参数。<code>label, properties</code><code>limit</code>之间可以任意组合。</p><p>属性键值对由属性名称和属性值组成JSON格式的对象,可以使用多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配的形式如<code>properties={"age":29}</code>,范围匹配的形式如<code>properties={"age":"P.gt(29)"}</code>,范围匹配支持以下表达式:</p><table><thead><tr><th>表达式</th><th>说明</th></tr></thead><tbody><tr><td>P.eq(number)</td><td>属性值等于number的顶点</td></tr><tr><td>P.neq(number)</td><td>属性值不等于number的顶点</td></tr><tr><td>P.lt(number)</td><td>属性值小于number的顶点</td></tr><tr><td>P.lte(number)</td><td>属性值小于等于number的顶点</td></tr><tr><td>P.gt(number)</td><td>属性值大于number的顶点</td></tr><tr><td>P.gte(number)</td><td>属性值大于等于number的顶点</td></tr><tr><td>P.between(number1,number2)</td><td>属性值大于等于number1且小于number2的顶点</td></tr><tr><td>P.inside(number1,number2)</td><td>属性值大于number1且小于number2的顶点</td></tr><tr><td>P.outside(number1,number2)</td><td>属性值小于number1且大于number2的顶点</td></tr><tr><td>P.within(value1,value2,value3,&mldr;)</td><td>属性值等于任何一个给定value的顶点</td></tr></tbody></table><p><strong>查询所有 age 为 29 且 label 为 person 的顶点</strong></p><h5 id=method--url-5>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph/vertices?label=person&amp;properties={&#34;age&#34;:29}&amp;limit=1
</span></span></code></pre></div><h5 id=response-status-5>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-5>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p><strong>分页查询所有顶点,获取第一页(page不带参数值),限定3条</strong></p><p>通过以下命令新增顶点:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span>curl -H <span style=color:#4e9a06>&#34;Content-Type: application/json&#34;</span> -d <span style=color:#4e9a06>&#39;[{&#34;label&#34;:&#34;person&#34;,&#34;properties&#34;:{&#34;name&#34;:&#34;peter&#34;,&#34;age&#34;:29,&#34;city&#34;:&#34;Shanghai&#34;}},{&#34;label&#34;:&#34;person&#34;,&#34;properties&#34;:{&#34;name&#34;:&#34;vadas&#34;,&#34;age&#34;:27,&#34;city&#34;:&#34;Hongkong&#34;}}]&#39;</span> http://localhost:8080/graphs/hugegraph/graph/vertices/batch
</span></span></code></pre></div><h5 id=method--url-6>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph/vertices?page&amp;limit=3
</span></span></code></pre></div><h5 id=response-status-6>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-6>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;c++&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hobby&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;reading&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;football&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;swimming&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;page&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;CIYxOnBldGVyAAAAAAAAAAM=&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>返回的 <code>body</code> 里面是带有下一页的页号信息的,<code>"page": "CIYxOnBldGVyAAAAAAAAAAM="</code>,在查询下一页的时候将该值赋给 <code>page</code> 参数。</p><p><strong>分页查询所有顶点,获取下一页(page带上上一页返回的page值),限定3条</strong></p><h5 id=method--url-7>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph/vertices?page=CIYxOnBldGVyAAAAAAAAAAM=&amp;limit=3
</span></span></code></pre></div><h5 id=response-status-7>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-7>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;page&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p><code>"page": null</code>时,表示已经没有下一页了(注:如果后端使用的是 Cassandra ,为了提高性能,当返回的页数刚好是最后一页时,返回的 <code>page</code> 值可能不为空,但是如果用这个 <code>page</code> 值再请求下一页数据时,就会返回 <code>空数据</code><code>page = null</code>,其他情况也类似)</p><h4 id=217-根据id获取顶点>2.1.7 根据Id获取顶点</h4><h5 id=method--url-8>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph/vertices/&#34;1:marko&#34;
</span></span></code></pre></div><h5 id=response-status-8>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-8>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>30</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=218-根据id删除顶点>2.1.8 根据Id删除顶点</h4><h5 id=params-1>Params</h5><ul><li>label: 顶点类型,可选参数</li></ul><p><strong>仅根据Id删除顶点</strong></p><h5 id=method--url-9>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/graph/vertices/&#34;1:marko&#34;
</span></span></code></pre></div><h5 id=response-status-9>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><p><strong>根据Label+Id删除顶点</strong></p><p>通过指定Label参数和Id来删除顶点时,一般来说其性能比仅根据Id删除会更好。</p><h5 id=method--url-10>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/graph/vertices/&#34;1:marko&#34;?label=person
</span></span></code></pre></div><h5 id=response-status-10>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-f40127b155ddd802d50c507ff1cf5530>5.1.8 - Edge API</h1><h3 id=22-edge>2.2 Edge</h3><p>顶点 id 格式的修改也影响到了边的 id 以及源顶点和目标顶点 id 的格式</p><p>EdgeId 是由 <code>src-vertex-id + direction + label + sort-values + tgt-vertex-id</code> 拼接而成,但是这里的顶点 id 类型不是通过引号区分的,而是根据前缀区分:</p><ul><li>当 id 类型为 number 时,EdgeId 的顶点 id 前有一个前缀 <code>L</code> ,形如 &ldquo;L123456>1&#187;L987654&rdquo;</li><li>当 id 类型为 string 时,EdgeId 的顶点 id 前有一个前缀 <code>S</code> ,形如 &ldquo;S1:peter>1&#187;S2:lop&rdquo;</li></ul><hr><p>接下来的示例需要先根据以下 <code>groovy</code> 脚本创建图 <code>schema</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.HugeFactory</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.tinkerpop.gremlin.structure.T</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>conf</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;conf/graphs/hugegraph.properties&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>HugeFactory</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>open</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>conf</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knowsByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>marko</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>vadas</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>lop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>328</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>josh</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>ripple</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>199</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>peter</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>35</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>tx</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>commit</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>g</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>traversal</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=221-创建一条边>2.2.1 创建一条边</h4><h5 id=params>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li></ul><p><strong>请求体说明:</strong></p><ul><li>label:边类型名称,必填</li><li>outV:源顶点 id,必填</li><li>inV:目标顶点 id,必填</li><li>outVLabel:源顶点类型,必填</li><li>inVLabel:目标顶点类型,必填</li><li>properties: 边关联的属性,对象内部结构为:<ol><li>name:属性名称</li><li>value:属性值</li></ol></li></ul><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/graph/edges
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=222-创建多条边>2.2.2 创建多条边</h4><h5 id=params-1>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li></ul><p><strong>请求参数说明:</strong></p><ul><li>check_vertex:是否检查顶点存在 (true | false),当设置为 true 而待插入边的源顶点或目标顶点不存在时会报错,默认为 true</li></ul><p><strong>请求体说明:</strong></p><ul><li>边信息的列表</li></ul><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/graph/edges/batch
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160110&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.5</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130220&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>]</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:josh&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>]</span>
</span></span></code></pre></div><h4 id=223-更新边属性>2.2.3 更新边属性</h4><h5 id=params-2>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li><li>id:待操作的边 id</li></ul><p><strong>请求参数说明:</strong></p><ul><li>action:append 操作</li></ul><p><strong>请求体说明:</strong></p><ul><li>边信息</li></ul><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/graph/edges/S1:marko&gt;2&gt;&gt;S2:lop?action=append
</span></span></code></pre></div><h5 id=request-body-2>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>注意:属性的取值是有三种类别的,分别是 single、set 和 list。如果是 single,表示增加或更新属性值;如果是 set 或 list,则表示追加属性值</p></blockquote><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=224-批量更新边属性>2.2.4 批量更新边属性</h4><h5 id=params-3>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li></ul><p><strong>请求体说明:</strong></p><ul><li>edges:边信息的列表</li><li>update_strategies:对于每个属性,可以单独设置其更新策略,包括:<ul><li>SUM:仅支持 number 类型</li><li>BIGGER/SMALLER:仅支持 date/number 类型</li><li>UNION/INTERSECTION:仅支持 set 类型</li><li>APPEND/ELIMINATE:仅支持 collection 类型</li><li>OVERRIDE</li></ul></li><li>check_vertex:是否检查顶点存在 (true | false),当设置为 true 而待插入边的源顶点或目标顶点不存在时会报错,默认为 true</li><li>create_if_not_exist:目前只支持设定为 true</li></ul><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://127.0.0.1:8080/graphs/hugegraph/graph/edges/batch
</span></span></code></pre></div><h5 id=request-body-3>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160111&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130221&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.5</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;update_strategies&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;SUM&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OVERRIDE&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;check_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;create_if_not_exist&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160111&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130221&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=225-删除边属性>2.2.5 删除边属性</h4><h5 id=params-4>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li><li>id:待操作的边 id</li></ul><p><strong>请求参数说明:</strong></p><ul><li>action:eliminate 操作</li></ul><p><strong>请求体说明:</strong></p><ul><li>边信息</li></ul><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/graph/edges/S1:marko&gt;2&gt;&gt;S2:lop?action=eliminate
</span></span></code></pre></div><h5 id=request-body-4>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>注意:这里会直接删除属性(删除 key 和所有 value),无论其属性的取值是 single、set 或 list</p></blockquote><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>400</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><p>无法删除未设置为 nullable 的属性</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;exception&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;class java.lang.IllegalArgumentException&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;message&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Can&#39;t remove non-null edge property &#39;p[weight-&gt;1.0]&#39;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cause&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=226-获取符合条件的边>2.2.6 获取符合条件的边</h4><h5 id=params-5>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li></ul><p><strong>请求参数说明:</strong></p><ul><li>vertex_id: 顶点 id</li><li>direction: 边的方向 (OUT | IN | BOTH),默认为 BOTH</li><li>label: 边的标签</li><li>properties: 属性键值对 (根据属性查询的前提是预先建立了索引)</li><li>keep_start_p: 默认为 false,当设置为 true 后,不会自动转义范围匹配输入的表达式,例如此时 <code>properties={"age":"P.gt(0.8)"}</code> 会被理解为精确匹配,即 age 属性等于 &ldquo;P.gt(0.8)&rdquo;</li><li>offset:偏移,默认为 0</li><li>limit: 查询数目,默认为 100</li><li>page: 页号</li></ul><p>属性键值对由 JSON 格式的属性名称和属性值组成,允许多个属性键值对作为查询条件,属性值支持精确匹配和范围匹配,精确匹配时形如 <code>properties={"weight":0.8}</code>,范围匹配时形如 <code>properties={"age":"P.gt(0.8)"}</code>,范围匹配支持的表达式如下:</p><table><thead><tr><th>表达式</th><th>说明</th></tr></thead><tbody><tr><td>P.eq(number)</td><td>属性值等于 number 的边</td></tr><tr><td>P.neq(number)</td><td>属性值不等于 number 的边</td></tr><tr><td>P.lt(number)</td><td>属性值小于 number 的边</td></tr><tr><td>P.lte(number)</td><td>属性值小于等于 number 的边</td></tr><tr><td>P.gt(number)</td><td>属性值大于 number 的边</td></tr><tr><td>P.gte(number)</td><td>属性值大于等于 number 的边</td></tr><tr><td>P.between(number1,number2)</td><td>属性值大于等于 number1 且小于 number2 的边</td></tr><tr><td>P.inside(number1,number2)</td><td>属性值大于 number1 且小于 number2 的边</td></tr><tr><td>P.outside(number1,number2)</td><td>属性值小于 number1 且大于 number2 的边</td></tr><tr><td>P.within(value1,value2,value3,&mldr;)</td><td>属性值等于任何一个给定 value 的边</td></tr><tr><td>P.textcontains(value)</td><td>属性值包含给定 value 的边 (string 类型)</td></tr><tr><td>P.contains(value)</td><td>属性值包含给定 value 的边 (collection 类型)</td></tr></tbody></table><p><strong>查询与顶点 person:marko(vertex_id=&ldquo;1:marko&rdquo;) 相连且 label 为 knows 的且 date 属性等于 &ldquo;20160111&rdquo; 的边</strong></p><h5 id=method--url-5>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://127.0.0.1:8080/graphs/hugegraph/graph/edges?vertex_id=&#34;1:marko&#34;&amp;label=knows&amp;properties={&#34;date&#34;:&#34;P.within(\&#34;20160111\&#34;)&#34;}
</span></span></code></pre></div><h5 id=response-status-5>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-5>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160111&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p><strong>分页查询所有边,获取第一页(page 不带参数值),限定 2 条</strong></p><h5 id=method--url-6>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://127.0.0.1:8080/graphs/hugegraph/graph/edges?page&amp;limit=2
</span></span></code></pre></div><h5 id=response-status-6>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-6>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130221&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160111&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;page&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;EoYxOm1hcmtvgggCAIQyOmxvcAAAAAAAAAAC&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>返回的 body 里面是带有下一页的页号信息的,<code>"page": "EoYxOm1hcmtvgggCAIQyOmxvcAAAAAAAAAAC"</code>,在查询下一页的时候将该值赋给 page 参数</p><p><strong>分页查询所有边,获取下一页(page 带上上一页返回的 page 值),限定 2 条</strong></p><h5 id=method--url-7>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://127.0.0.1:8080/graphs/hugegraph/graph/edges?page=EoYxOm1hcmtvgggCAIQyOmxvcAAAAAAAAAAC&amp;limit=2
</span></span></code></pre></div><h5 id=response-status-7>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-7>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;page&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>此时 <code>"page": null</code> 表示已经没有下一页了</p><blockquote><p>注:后端为 Cassandra 时,为了性能考虑,返回页恰好为最后一页时,返回 <code>page</code> 值可能非空,通过该 <code>page</code> 再请求下一页数据时则返回 <code>空数据</code><code>page = null</code>,其他情况类似</p></blockquote><h4 id=227-根据-id-获取边>2.2.7 根据 id 获取边</h4><h5 id=params-6>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li><li>id:待操作的边 id</li></ul><h5 id=method--url-8>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph/edges/S1:marko&gt;2&gt;&gt;S2:lop
</span></span></code></pre></div><h5 id=response-status-8>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-8>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=228-根据-id-删除边>2.2.8 根据 id 删除边</h4><h5 id=params-7>Params</h5><p><strong>路径参数说明:</strong></p><ul><li>graph:待操作的图</li><li>id:待操作的边 id</li></ul><p><strong>请求参数说明:</strong></p><ul><li>label: 边的标签</li></ul><p><strong>仅根据 id 删除边</strong></p><h5 id=method--url-9>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/graph/edges/S1:marko&gt;2&gt;&gt;S2:lop
</span></span></code></pre></div><h5 id=response-status-9>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><p><strong>根据 label + id 删除边</strong></p><p>通过指定 label 参数和 id 来删除边时,一般来说其性能比仅根据 id 删除会更好</p><h5 id=method--url-10>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/graph/edges/S1:marko&gt;1&gt;&gt;S1:vadas?label=knows
</span></span></code></pre></div><h5 id=response-status-10>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-f0adc653be0b454ce1952bdaf0afefa6>5.1.9 - Traverser API</h1><h3 id=31-traverser-api概述>3.1 traverser API概述</h3><p>HugeGraphServer为HugeGraph图数据库提供了RESTful API接口。除了顶点和边的CRUD基本操作以外,还提供了一些遍历(traverser)方法,我们称为<code>traverser API</code>。这些遍历方法实现了一些复杂的图算法,方便用户对图进行分析和挖掘。</p><p>HugeGraph支持的Traverser API包括:</p><ul><li>K-out API,根据起始顶点,查找恰好N步可达的邻居,分为基础版和高级版:<ul><li>基础版使用GET方法,根据起始顶点,查找恰好N步可达的邻居</li><li>高级版使用POST方法,根据起始顶点,查找恰好N步可达的邻居,与基础版的不同在于:<ul><li>支持只统计邻居数量</li><li>支持顶点和边属性过滤</li><li>支持返回到达邻居的最短路径</li></ul></li></ul></li><li>K-neighbor API,根据起始顶点,查找N步以内可达的所有邻居,分为基础版和高级版:<ul><li>基础版使用GET方法,根据起始顶点,查找N步以内可达的所有邻居</li><li>高级版使用POST方法,根据起始顶点,查找N步以内可达的所有邻居,与基础版的不同在于:<ul><li>支持只统计邻居数量</li><li>支持顶点和边属性过滤</li><li>支持返回到达邻居的最短路径</li></ul></li></ul></li><li>Same Neighbors, 查询两个顶点的共同邻居</li><li>Jaccard Similarity API,计算jaccard相似度,包括两种:<ul><li>一种是使用GET方法,计算两个顶点的邻居的相似度(交并比)</li><li>一种是使用POST方法,在全图中查找与起点的jaccard similarity最高的N个点</li></ul></li><li>Shortest Path API,查找两个顶点之间的最短路径</li><li>All Shortest Paths,查找两个顶点间的全部最短路径</li><li>Weighted Shortest Path,查找起点到目标点的带权最短路径</li><li>Single Source Shortest Path,查找一个点到其他各个点的加权最短路径</li><li>Multi Node Shortest Path,查找指定顶点集之间两两最短路径</li><li>Paths API,查找两个顶点间的全部路径,分为基础版和高级版:<ul><li>基础版使用GET方法,根据起点和终点,查找两个顶点间的全部路径</li><li>高级版使用POST方法,根据一组起点和一组终点,查找两个集合间符合条件的全部路径</li></ul></li><li>Customized Paths API,从一批顶点出发,按(一种)模式遍历经过的全部路径</li><li>Template Path API,指定起点和终点以及起点和终点间路径信息,查找符合的路径</li><li>Crosspoints API,查找两个顶点的交点(共同祖先或者共同子孙)</li><li>Customized Crosspoints API,从一批顶点出发,按多种模式遍历,最后一步到达的顶点的交点</li><li>Rings API,从起始顶点出发,可到达的环路路径</li><li>Rays API,从起始顶点出发,可到达边界的路径(即无环路径)</li><li>Fusiform Similarity API,查找一个顶点的梭形相似点</li><li>Vertices API<ul><li>按ID批量查询顶点;</li><li>获取顶点的分区;</li><li>按分区查询顶点;</li></ul></li><li>Edges API<ul><li>按ID批量查询边;</li><li>获取边的分区;</li><li>按分区查询边;</li></ul></li></ul><h3 id=32-traverser-api详解>3.2. traverser API详解</h3><p>使用方法中的例子,都是基于TinkerPop官网给出的图:</p><p><img src=http://tinkerpop.apache.org/docs/3.4.0/images/tinkerpop-modern.png alt=tinkerpop示例图></p><p>数据导入程序如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>Loader</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>[]</span> <span style=color:#000>args</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>HugeClient</span> <span style=color:#000>client</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;http://127.0.0.1:8080&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>SchemaManager</span> <span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>client</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asDouble</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByCity&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAgeAndCity&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;softwareByPrice&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>multiTimes</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sortKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knowsByWeight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>GraphManager</span> <span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>client</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>graph</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>marko</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>29</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>vadas</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>27</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>lop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>328</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>josh</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>32</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>ripple</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>199</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>peter</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>35</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20160110&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>5</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20130220&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>0</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>4</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20091111&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>4</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>0</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;20170324&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>2</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><p>顶点ID为:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>&#34;2:ripple&#34;,
</span></span><span style=display:flex><span>&#34;1:vadas&#34;,
</span></span><span style=display:flex><span>&#34;1:peter&#34;,
</span></span><span style=display:flex><span>&#34;1:josh&#34;,
</span></span><span style=display:flex><span>&#34;1:marko&#34;,
</span></span><span style=display:flex><span>&#34;2:lop&#34;
</span></span></code></pre></div><p>边ID为:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>&#34;S1:peter&gt;2&gt;&gt;S2:lop&#34;,
</span></span><span style=display:flex><span>&#34;S1:josh&gt;2&gt;&gt;S2:lop&#34;,
</span></span><span style=display:flex><span>&#34;S1:josh&gt;2&gt;&gt;S2:ripple&#34;,
</span></span><span style=display:flex><span>&#34;S1:marko&gt;1&gt;20130220&gt;S1:josh&#34;,
</span></span><span style=display:flex><span>&#34;S1:marko&gt;1&gt;20160110&gt;S1:vadas&#34;,
</span></span><span style=display:flex><span>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;
</span></span></code></pre></div><h4 id=321-k-out-apiget基础版>3.2.1 K-out API(GET,基础版)</h4><h5 id=3211-功能介绍>3.2.1.1 功能介绍</h5><p>根据起始顶点、方向、边的类型(可选)和深度depth,查找从起始顶点出发恰好depth步可达的顶点</p><h6 id=params>Params</h6><ul><li>source:起始顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>max_depth:步数,必填项</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>nearest:nearest为true时,代表起始顶点到达结果顶点的最短路径长度为depth,不存在更短的路径;nearest为false时,代表起始顶点到结果顶点有一条长度为depth的路径(未必最短且可以有环),选填项,默认为true</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的顶点的最大数目,选填项,默认为10000000</li></ul><h5 id=3212-使用方法>3.2.1.2 使用方法</h5><h6 id=method--url>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/kout?source=&#34;1:marko&#34;&amp;max_depth=2
</span></span></code></pre></div><h6 id=response-status>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3213-适用场景>3.2.1.3 适用场景</h5><p>查找恰好N步关系可达的顶点。两个例子:</p><ul><li>家族关系中,查找一个人的所有孙子,person A通过连续的两条“儿子”边到达的顶点集合。</li><li>社交关系中发现潜在好友,例如:与目标用户相隔两层朋友关系的用户,可以通过连续两条“朋友”边到达的顶点。</li></ul><h4 id=322-k-out-apipost高级版>3.2.2 K-out API(POST,高级版)</h4><h5 id=3221-功能介绍>3.2.2.1 功能介绍</h5><p>根据起始顶点、步骤(包括方向、边类型和过滤属性)和深度depth,查找从起始顶点出发恰好depth步可达的顶点。</p><blockquote><p>与K-out基础版的不同在于:</p><ul><li>支持只统计邻居数量</li><li>支持边属性过滤</li><li>支持返回到达邻居的最短路径</li></ul></blockquote><h6 id=params-1>Params</h6><ul><li>source:起始顶点id,必填项</li><li>steps: 从起始点出发的Steps,必填项,结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>edge_steps:边Step集合,支持对单边的类型和属性过滤,如果为空,则不过滤<ul><li>label:边类型</li><li>properties:边属性</li></ul></li><li>vertex_steps:顶点Step集合,支持对单点的类型和属性过滤,如果为空,则不过滤<ul><li>label:顶点类型</li><li>properties:顶点属性</li></ul></li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>max_depth:步数,必填项</li><li>nearest:nearest为true时,代表起始顶点到达结果顶点的最短路径长度为depth,不存在更短的路径;nearest为false时,代表起始顶点到结果顶点有一条长度为depth的路径(未必最短且可以有环),选填项,默认为true</li><li>count_only:Boolean值,true表示只统计结果的数目,不返回具体结果;false表示返回具体的结果,默认为false</li><li>with_path:true表示返回起始点到每个邻居的最短路径,false表示不返回起始点到每个邻居的最短路径,选填项,默认为false</li><li>with_edge,选填项,默认为false:<ul><li>如果设置为true,则结果将包含所有边的完整信息,即路径中的所有边<ul><li>当with_path为true时,将返回所有路径中的边的完整信息</li><li>当with_path为false时,不返回任何信息</li></ul></li><li>如果设置为false,则仅返回边的id</li></ul></li><li>with_vertex,选填项,默认为false:<ul><li>如果设置为true,则结果将包含所有顶点的完整信息,即路径中的所有顶点<ul><li>当with_path为true时,将返回所有路径中的顶点的完整信息</li><li>当with_path为false时,返回所有邻居顶点的完整信息</li></ul></li><li>如果设置为false,则仅返回顶点的id</li></ul></li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的顶点的最大数目,选填项,默认为10000000</li><li>traverse_mode: 遍历方式,可选择“breadth_first_search”或“depth_first_search”作为参数,默认为“breadth_first_search”</li></ul><h5 id=3222-使用方法>3.2.2.2 使用方法</h5><h6 id=method--url-1>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/kout
</span></span></code></pre></div><h6 id=request-body>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BOTH&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edge_steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;P.gt(0.1)&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;P.gt(0.1)&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertex_steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;P.lt(32)&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_depth&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nearest&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_edge&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-1>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-1>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;kout&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;20160110&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20160110&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3223-适用场景>3.2.2.3 适用场景</h5><p>参见3.2.1.3</p><h4 id=323-k-neighborget基础版>3.2.3 K-neighbor(GET,基础版)</h4><h5 id=3231-功能介绍>3.2.3.1 功能介绍</h5><p>根据起始顶点、方向、边的类型(可选)和深度depth,查找包括起始顶点在内、depth步之内可达的所有顶点</p><blockquote><p>相当于:起始顶点、K-out(1)、K-out(2)、&mldr; 、K-out(max_depth)的并集</p></blockquote><h6 id=params-2>Params</h6><ul><li>source: 起始顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>max_depth:步数,必填项</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>limit:返回的顶点的最大数目,也即遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li></ul><h5 id=3232-使用方法>3.2.3.2 使用方法</h5><h6 id=method--url-2>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/kneighbor?source=“1:marko”&amp;max_depth=2
</span></span></code></pre></div><h6 id=response-status-2>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-2>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3233-适用场景>3.2.3.3 适用场景</h5><p>查找N步以内可达的所有顶点,例如:</p><ul><li>家族关系中,查找一个人五服以内所有子孙,person A通过连续的5条“亲子”边到达的顶点集合。</li><li>社交关系中发现好友圈子,例如目标用户通过1条、2条、3条“朋友”边可到达的用户可以组成目标用户的朋友圈子</li></ul><h4 id=324-k-neighbor-apipost高级版>3.2.4 K-neighbor API(POST,高级版)</h4><h5 id=3241-功能介绍>3.2.4.1 功能介绍</h5><p>根据起始顶点、步骤(包括方向、边类型和过滤属性)和深度depth,查找从起始顶点出发depth步内可达的所有顶点。</p><blockquote><p>与K-neighbor基础版的不同在于:</p><ul><li>支持只统计邻居数量</li><li>支持边属性过滤</li><li>支持返回到达邻居的最短路径</li></ul></blockquote><h6 id=params-3>Params</h6><ul><li>source:起始顶点id,必填项</li><li>steps: 从起始点出发的Steps,必填项,结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>从起始点出发的Steps,必填项,结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>edge_steps:边Step集合,支持对单边的类型和属性过滤,如果为空,则不过滤<ul><li>label:边类型</li><li>properties:边属性</li></ul></li><li>vertex_steps:顶点Step集合,支持对单点的类型和属性过滤,如果为空,则不过滤<ul><li>label:顶点类型</li><li>properties:顶点属性</li></ul></li></ul></li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>max_depth:步数,必填项</li><li>count_only:Boolean值,true表示只统计结果的数目,不返回具体结果;false表示返回具体的结果,默认为false</li><li>with_path:true表示返回起始点到每个邻居的最短路径,false表示不返回起始点到每个邻居的最短路径,选填项,默认为false</li><li>with_edge,选填项,默认为false:<ul><li>如果设置为true,则结果将包含所有边的完整信息,即路径中的所有边<ul><li>当with_path为true时,将返回所有路径中的边的完整信息</li><li>当with_path为false时,不返回任何信息</li></ul></li><li>如果设置为false,则仅返回边的id</li></ul></li><li>with_vertex,选填项,默认为false:<ul><li>如果设置为true,则结果将包含所有顶点的完整信息,即路径中的所有顶点<ul><li>当with_path为true时,将返回所有路径中的顶点的完整信息</li><li>当with_path为false时,返回所有邻居顶点的完整信息</li></ul></li><li>如果设置为false,则仅返回顶点的id</li></ul></li><li>limit:返回的顶点的最大数目,选填项,默认为10000000</li></ul><h5 id=3242-使用方法>3.2.4.2 使用方法</h5><h6 id=method--url-3>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/kneighbor
</span></span></code></pre></div><h6 id=request-body-1>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BOTH&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edge_steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertex_steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;P.gt(28)&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_depth&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_edge&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-3>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-3>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;kneighbor&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>35</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:josh&gt;2&gt;&gt;S2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;20130220&gt;S1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20130220&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:peter&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20170324&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3243-适用场景>3.2.4.3 适用场景</h5><p>参见3.2.3.3</p><h4 id=325-same-neighbors>3.2.5 Same Neighbors</h4><h5 id=3251-功能介绍>3.2.5.1 功能介绍</h5><p>查询两个点的共同邻居</p><h6 id=params-4>Params</h6><ul><li>vertex:一个顶点id,必填项</li><li>other:另一个顶点id,必填项</li><li>direction:顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>limit:返回的共同邻居的最大数目,选填项,默认为10000000</li></ul><h5 id=3252-使用方法>3.2.5.2 使用方法</h5><h6 id=method--url-4>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/sameneighbors?vertex=“1:marko”&amp;other=&#34;1:josh&#34;
</span></span></code></pre></div><h6 id=response-status-4>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-4>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;same_neighbors&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3253-适用场景>3.2.5.3 适用场景</h5><p>查找两个顶点的共同邻居:</p><ul><li>社交关系中发现两个用户的共同粉丝或者共同关注用户</li></ul><h4 id=326-jaccard-similarityget>3.2.6 Jaccard Similarity(GET)</h4><h5 id=3261-功能介绍>3.2.6.1 功能介绍</h5><p>计算两个顶点的jaccard similarity(两个顶点邻居的交集比上两个顶点邻居的并集)</p><h6 id=params-5>Params</h6><ul><li>vertex:一个顶点id,必填项</li><li>other:另一个顶点id,必填项</li><li>direction:顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li></ul><h5 id=3262-使用方法>3.2.6.2 使用方法</h5><h6 id=method--url-5>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/jaccardsimilarity?vertex=&#34;1:marko&#34;&amp;other=&#34;1:josh&#34;
</span></span></code></pre></div><h6 id=response-status-5>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-5>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;jaccard_similarity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.2</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3263-适用场景>3.2.6.3 适用场景</h5><p>用于评估两个点的相似性或者紧密度</p><h4 id=327-jaccard-similaritypost>3.2.7 Jaccard Similarity(POST)</h4><h5 id=3271-功能介绍>3.2.7.1 功能介绍</h5><p>计算与指定顶点的jaccard similarity最大的N个点</p><blockquote><p>jaccard similarity的计算方式为:两个顶点邻居的交集比上两个顶点邻居的并集</p></blockquote><h6 id=params-6>Params</h6><ul><li>vertex:一个顶点id,必填项</li><li>从起始点出发的Step,必填项,结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>top:返回一个起点的jaccard similarity中最大的top个,选填项,默认为100</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li></ul><h5 id=3272-使用方法>3.2.7.2 使用方法</h5><h6 id=method--url-6>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/jaccardsimilarity
</span></span></code></pre></div><h6 id=request-body-2>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;step&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BOTH&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;top&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-6>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-6>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3333333333333333</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3333333333333333</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.2</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3273-适用场景>3.2.7.3 适用场景</h5><p>用于在图中找出与指定顶点相似性最高的顶点</p><h4 id=328-shortest-path>3.2.8 Shortest Path</h4><h5 id=3281-功能介绍>3.2.8.1 功能介绍</h5><p>根据起始顶点、目的顶点、方向、边的类型(可选)和最大深度,查找一条最短路径</p><h6 id=params-7>Params</h6><ul><li>source:起始顶点id,必填项</li><li>target:目的顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>max_depth:最大步数,必填项</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li></ul><h5 id=3282-使用方法>3.2.8.2 使用方法</h5><h6 id=method--url-7>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/shortestpath?source=&#34;1:marko&#34;&amp;target=&#34;2:ripple&#34;&amp;max_depth=3
</span></span></code></pre></div><h6 id=response-status-7>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-7>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3283-适用场景>3.2.8.3 适用场景</h5><p>查找两个顶点间的最短路径,例如:</p><ul><li>社交关系网中,查找两个用户有关系的最短路径,即最近的朋友关系链</li><li>设备关联网络中,查找两个设备最短的关联关系</li></ul><h4 id=329-all-shortest-paths>3.2.9 All Shortest Paths</h4><h5 id=3291-功能介绍>3.2.9.1 功能介绍</h5><p>根据起始顶点、目的顶点、方向、边的类型(可选)和最大深度,查找两点间所有的最短路径</p><h6 id=params-8>Params</h6><ul><li>source:起始顶点id,必填项</li><li>target:目的顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>max_depth:最大步数,必填项</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li></ul><h5 id=3292-使用方法>3.2.9.2 使用方法</h5><h6 id=method--url-8>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/allshortestpaths?source=&#34;A&#34;&amp;target=&#34;Z&#34;&amp;max_depth=10
</span></span></code></pre></div><h6 id=response-status-8>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-8>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;A&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;B&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;C&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;Z&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;A&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;M&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;N&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;Z&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=3293-适用场景>3.2.9.3 适用场景</h5><p>查找两个顶点间的所有最短路径,例如:</p><ul><li>社交关系网中,查找两个用户有关系的全部最短路径,即最近的朋友关系链</li><li>设备关联网络中,查找两个设备全部的最短关联关系</li></ul><h4 id=3210-weighted-shortest-path>3.2.10 Weighted Shortest Path</h4><h5 id=32101-功能介绍>3.2.10.1 功能介绍</h5><p>根据起始顶点、目的顶点、方向、边的类型(可选)和最大深度,查找一条带权最短路径</p><h6 id=params-9>Params</h6><ul><li>source:起始顶点id,必填项</li><li>target:目的顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>weight:边的权重属性,必填项,必须是数字类型的属性</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32102-使用方法>3.2.10.2 使用方法</h5><h6 id=method--url-9>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/weightedshortestpath?source=&#34;1:marko&#34;&amp;target=&#34;2:ripple&#34;&amp;weight=&#34;weight&#34;&amp;with_vertex=true
</span></span></code></pre></div><h6 id=response-status-9>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-9>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32103-适用场景>3.2.10.3 适用场景</h5><p>查找两个顶点间的带权最短路径,例如:</p><ul><li>交通线路中查找从A城市到B城市花钱最少的交通方式</li></ul><h4 id=3211-single-source-shortest-path>3.2.11 Single Source Shortest Path</h4><h5 id=32111-功能介绍>3.2.11.1 功能介绍</h5><p>从一个顶点出发,查找该点到图中其他顶点的最短路径(可选是否带权重)</p><h6 id=params-10>Params</h6><ul><li>source:起始顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>weight:边的权重属性,选填项,必须是数字类型的属性,如果不填或者虽然填了但是边没有该属性,则权重为1.0</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:查询到的目标顶点个数,也是返回的最短路径的条数,选填项,默认为10</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32112-使用方法>3.2.11.2 使用方法</h5><h6 id=method--url-10>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/singlesourceshortestpath?source=&#34;1:marko&#34;&amp;with_vertex=true
</span></span></code></pre></div><h6 id=response-status-10>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-10>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>35</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32113-适用场景>3.2.11.3 适用场景</h5><p>查找从一个点出发到其他顶点的带权最短路径,比如:</p><ul><li>查找从北京出发到全国其他所有城市的耗时最短的乘车方案</li></ul><h4 id=3212-multi-node-shortest-path>3.2.12 Multi Node Shortest Path</h4><h5 id=32121-功能介绍>3.2.12.1 功能介绍</h5><p>查找指定顶点集两两之间的最短路径</p><h6 id=params-11>Params</h6><ul><li>vertices:定义起始顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>step:表示从起始顶点到终止顶点走过的路径,必填项,Step的结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>max_depth:步数,必填项</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32122-使用方法>3.2.12.2 使用方法</h5><h6 id=method--url-11>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/multinodeshortestpath
</span></span></code></pre></div><h6 id=request-body-3>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;step&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BOTH&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_depth&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-11>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-11>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;382:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;383:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;382:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;382:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;382:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;383:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32123-适用场景>3.2.12.3 适用场景</h5><p>查找多个点之间的最短路径,比如:</p><ul><li>查找多个公司和法人之间的最短路径</li></ul><h4 id=3213-paths-get基础版>3.2.13 Paths (GET,基础版)</h4><h5 id=32131-功能介绍>3.2.13.1 功能介绍</h5><p>根据起始顶点、目的顶点、方向、边的类型(可选)和最大深度等条件查找所有路径</p><h6 id=params-12>Params</h6><ul><li>source:起始顶点id,必填项</li><li>target:目的顶点id,必填项</li><li>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_depth:步数,必填项</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的路径的最大数目,选填项,默认为10</li></ul><h5 id=32132-使用方法>3.2.13.2 使用方法</h5><h6 id=method--url-12>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/paths?source=&#34;1:marko&#34;&amp;target=&#34;1:josh&#34;&amp;max_depth=5
</span></span></code></pre></div><h6 id=response-status-12>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-12>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32133-适用场景>3.2.13.3 适用场景</h5><p>查找两个顶点间的所有路径,例如:</p><ul><li>社交网络中,查找两个用户所有可能的关系路径</li><li>设备关联网络中,查找两个设备之间所有的关联路径</li></ul><h4 id=3214-paths-post高级版>3.2.14 Paths (POST,高级版)</h4><h5 id=32141-功能介绍>3.2.14.1 功能介绍</h5><p>根据起始顶点、目的顶点、步骤(step)和最大深度等条件查找所有路径</p><h6 id=params-13>Params</h6><ul><li>sources:定义起始顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>targets:定义终止顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供终止顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询终止顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询终止顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>step:表示从起始顶点到终止顶点走过的路径,必填项,Step的结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>max_depth:步数,必填项</li><li>nearest:nearest为true时,代表起始顶点到达结果顶点的最短路径长度为depth,不存在更短的路径;nearest为false时,代表起始顶点到结果顶点有一条长度为depth的路径(未必最短且可以有环),选填项,默认为true</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的路径的最大数目,选填项,默认为10</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32142-使用方法>3.2.14.2 使用方法</h5><h6 id=method--url-13>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/paths
</span></span></code></pre></div><h6 id=request-body-4>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;sources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;targets&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;step&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;BOTH&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;P.gt(0.01)&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;max_depth&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-13>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-13>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32143-适用场景>3.2.14.3 适用场景</h5><p>查找两个顶点间的所有路径,例如:</p><ul><li>社交网络中,查找两个用户所有可能的关系路径</li><li>设备关联网络中,查找两个设备之间所有的关联路径</li></ul><h4 id=3215-customized-paths>3.2.15 Customized Paths</h4><h5 id=32151-功能介绍>3.2.15.1 功能介绍</h5><p>根据一批起始顶点、边规则(包括方向、边的类型和属性过滤)和最大深度等条件查找符合条件的所有的路径</p><h6 id=params-14>Params</h6><ul><li>sources:定义起始顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>steps:表示从起始顶点走过的路径规则,是一组Step的列表。必填项。每个Step的结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>weight_by:根据指定的属性计算边的权重,sort_by不为NONE时有效,与default_weight互斥</li><li>default_weight:当边没有属性作为权重计算值时,采取的默认权重,sort_by不为NONE时有效,与weight_by互斥</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>sample:当需要对某个step的符合条件的边进行采样时设置,-1表示不采样,默认为采样100</li></ul></li><li>sort_by:根据路径的权重排序,选填项,默认为NONE:<ul><li>NONE表示不排序,默认值</li><li>INCR表示按照路径权重的升序排序</li><li>DECR表示按照路径权重的降序排序</li></ul></li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的路径的最大数目,选填项,默认为10</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32152-使用方法>3.2.15.2 使用方法</h5><h6 id=method--url-14>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/customizedpaths
</span></span></code></pre></div><h6 id=request-body-5>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sources&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;knows&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight_by&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;weight&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;created&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;default_weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sample&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sort_by&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;INCR&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-14>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-14>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weights&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#0000cf;font-weight:700>8</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>32</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32153-适用场景>3.2.15.3 适用场景</h5><p>适合查找各种复杂的路径集合,例如:</p><ul><li>社交网络中,查找看过张艺谋所导演的电影的用户关注的大V的路径(张艺谋&mdash;>电影&mdash;->用户&mdash;>大V)</li><li>风控网络中,查找多个高风险用户的直系亲属的朋友的路径(高风险用户&mdash;>直系亲属&mdash;>朋友)</li></ul><h4 id=3216-template-paths>3.2.16 Template Paths</h4><h5 id=32161-功能介绍>3.2.16.1 功能介绍</h5><p>根据一批起始顶点、边规则(包括方向、边的类型和属性过滤)和最大深度等条件查找符合条件的所有的路径</p><h6 id=params-15>Params</h6><ul><li>sources:定义起始顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>targets:定义终止顶点,必填项,指定方式包括:<ul><li>ids:通过顶点id列表提供终止顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询终止顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询终止顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li>steps:表示从起始顶点走过的路径规则,是一组Step的列表。必填项。每个Step的结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>max_times:当前step可以重复的次数,当为N时,表示从起始顶点可以经过当前step 1-N 次</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li><li>with_ring:Boolean值,true表示包含环路;false表示不包含环路,默认为false</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的路径的最大数目,选填项,默认为10</li><li>with_vertex:true表示返回结果包含完整的顶点信息(路径中的全部顶点),false时表示只返回顶点id,选填项,默认为false</li></ul><h5 id=32162-使用方法>3.2.16.2 使用方法</h5><h6 id=method--url-15>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/templatepaths
</span></span></code></pre></div><h6 id=request-body-6>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;targets&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;IN&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;IN&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;skip_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>100000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-15>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-15>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>32</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>27</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32163-适用场景>3.2.16.3 适用场景</h5><p>适合查找各种复杂的模板路径,比如personA -(朋友)-> personB -(同学)-> personC,其中"朋友"和"同学"边可以分别是最多3层和4层的情况</p><h4 id=3217-crosspoints>3.2.17 Crosspoints</h4><h5 id=32171-功能介绍>3.2.17.1 功能介绍</h5><p>根据起始顶点、目的顶点、方向、边的类型(可选)和最大深度等条件查找相交点</p><h6 id=params-16>Params</h6><ul><li>source:起始顶点id,必填项</li><li>target:目的顶点id,必填项</li><li>direction:起始顶点到目的顶点的方向, 目的点到起始点是反方向,BOTH时不考虑方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_depth:步数,必填项</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的交点的最大数目,选填项,默认为10</li></ul><h5 id=32172-使用方法>3.2.17.2 使用方法</h5><h6 id=method--url-16>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/crosspoints?source=&#34;2:lop&#34;&amp;target=&#34;2:ripple&#34;&amp;max_depth=5&amp;direction=IN
</span></span></code></pre></div><h6 id=response-status-16>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-16>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;crosspoints&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;crosspoint&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32173-适用场景>3.2.17.3 适用场景</h5><p>查找两个顶点的交点及其路径,例如:</p><ul><li>社交网络中,查找两个用户共同关注的话题或者大V</li><li>家族关系中,查找共同的祖先</li></ul><h4 id=3218-customized-crosspoints>3.2.18 Customized Crosspoints</h4><h5 id=32181-功能介绍>3.2.18.1 功能介绍</h5><p>根据一批起始顶点、多种边规则(包括方向、边的类型和属性过滤)和最大深度等条件查找符合条件的所有的路径终点的交集</p><h6 id=params-17>Params</h6><ul><li><p>sources:定义起始顶点,必填项,指定方式包括:</p><ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li><p>path_patterns:表示从起始顶点走过的路径规则,是一组规则的列表。必填项。每个规则是一个PathPattern</p><ul><li>每个PathPattern是一组Step列表,每个Step结构如下:<ul><li>direction:表示边的方向(OUT,IN,BOTH),默认是BOTH</li><li>labels:边的类型列表</li><li>properties:通过属性的值过滤边</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>skip_degree:用于设置查询过程中舍弃超级顶点的最小边数,即当某个顶点的邻接边数目大于 skip_degree 时,完全舍弃该顶点。选填项,如果开启时,需满足 <code>skip_degree >= max_degree</code> 约束,默认为0 (不启用),表示不跳过任何点 (注意: 开启此配置后,遍历时会尝试访问一个顶点的 skip_degree 条边,而不仅仅是 max_degree 条边,这样有额外的遍历开销,对查询性能影响可能有较大影响,请确认理解后再开启)</li></ul></li></ul></li><li><p>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</p></li><li><p>limit:返回的路径的最大数目,选填项,默认为10</p></li><li><p>with_path:true表示返回交点所在的路径,false表示不返回交点所在的路径,选填项,默认为false</p></li><li><p>with_vertex,选填项,默认为false:</p><ul><li>true表示返回结果包含完整的顶点信息(路径中的全部顶点)<ul><li>with_path为true时,返回所有路径中的顶点的完整信息</li><li>with_path为false时,返回所有交点的完整信息</li></ul></li><li>false时表示只返回顶点id</li></ul></li></ul><h5 id=32182-使用方法>3.2.18.2 使用方法</h5><h6 id=method--url-17>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/{graph}/traversers/customizedcrosspoints
</span></span></code></pre></div><h6 id=request-body-7>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sources&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path_patterns&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;IN&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;created&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_path&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-17>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-17>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;crosspoints&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;paths&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>32</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32183-适用场景>3.2.18.3 适用场景</h5><p>查询一组顶点通过多种路径在终点有交集的情况。例如:</p><ul><li>在商品图谱中,多款手机、学习机、游戏机通过不同的低级别的类目路径,最终都属于一级类目的电子设备</li></ul><h4 id=3219-rings>3.2.19 Rings</h4><h5 id=32191-功能介绍>3.2.19.1 功能介绍</h5><p>根据起始顶点、方向、边的类型(可选)和最大深度等条件查找可达的环路</p><p>例如:1 -> 25 -> 775 -> 14690 -> 25, 其中环路为 25 -> 775 -> 14690 -> 25</p><h6 id=params-18>Params</h6><ul><li>source:起始顶点id,必填项</li><li>direction:起始顶点发出的边的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_depth:步数,必填项</li><li>source_in_ring:环路是否包含起点,选填项,默认为true</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的可达环路的最大数目,选填项,默认为10</li></ul><h5 id=32192-使用方法>3.2.19.2 使用方法</h5><h6 id=method--url-18>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/rings?source=&#34;1:marko&#34;&amp;max_depth=2
</span></span></code></pre></div><h6 id=response-status-18>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-18>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rings&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32193-适用场景>3.2.19.3 适用场景</h5><p>查询起始顶点可达的环路,例如:</p><ul><li>风控项目中,查询一个用户可达的循环担保的人或者设备</li><li>设备关联网络中,发现一个设备周围的循环引用的设备</li></ul><h4 id=3220-rays>3.2.20 Rays</h4><h5 id=32201-功能介绍>3.2.20.1 功能介绍</h5><p>根据起始顶点、方向、边的类型(可选)和最大深度等条件查找发散到边界顶点的路径</p><p>例如:1 -> 25 -> 775 -> 14690 -> 2289 -> 18379, 其中 18379 为边界顶点,即没有从 18379 发出的边</p><h6 id=params-19>Params</h6><ul><li>source:起始顶点id,必填项</li><li>direction:起始顶点发出的边的方向(OUT,IN,BOTH),选填项,默认是BOTH</li><li>label:边的类型,选填项,默认代表所有edge label</li><li>max_depth:步数,必填项</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</li><li>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li><li>limit:返回的非环路的最大数目,选填项,默认为10</li></ul><h5 id=32202-使用方法>3.2.20.2 使用方法</h5><h6 id=method--url-19>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/traversers/rays?source=&#34;1:marko&#34;&amp;max_depth=2&amp;direction=OUT
</span></span></code></pre></div><h6 id=response-status-19>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-19>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rays&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;objects&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;2:lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32203-适用场景>3.2.20.3 适用场景</h5><p>查找起始顶点到某种关系的边界顶点的路径,例如:</p><ul><li>家族关系中,查找一个人到所有还没有孩子的子孙的路径</li><li>设备关联网络中,找到某个设备到终端设备的路径</li></ul><h4 id=3221-fusiform-similarity>3.2.21 Fusiform Similarity</h4><h5 id=32211-功能介绍>3.2.21.1 功能介绍</h5><p>按照条件查询一批顶点对应的"梭形相似点"。当两个顶点跟很多共同的顶点之间有某种关系的时候,我们认为这两个点为"梭形相似点"。举个例子说明"梭形相似点":&ldquo;读者A"读了100本书,可以定义读过这100本书中的80本以上的读者,是"读者A"的"梭形相似点&rdquo;</p><h6 id=params-20>Params</h6><ul><li><p>sources:定义起始顶点,必填项,指定方式包括:</p><ul><li>ids:通过顶点id列表提供起始顶点</li><li>label和properties:如果没有指定ids,则使用label和properties的联合条件查询起始顶点<ul><li>label:顶点的类型</li><li>properties:通过属性的值查询起始顶点</li></ul><blockquote><p>注意:properties中的属性值可以是列表,表示只要key对应的value在列表中就可以</p></blockquote></li></ul></li><li><p>label:边的类型,选填项,默认代表所有edge label</p></li><li><p>direction:起始顶点向外发散的方向(OUT,IN,BOTH),选填项,默认是BOTH</p></li><li><p>min_neighbors:最少邻居数目,邻居数目少于这个阈值时,认为起点不具备"梭形相似点"。比如想要找一个"读者A"读过的书的"梭形相似点",那么<code>min_neighbors</code>为100时,表示"读者A"至少要读过100本书才可以有"梭形相似点",必填项</p></li><li><p>alpha:相似度,代表:起点与"梭形相似点"的共同邻居数目占起点的全部邻居数目的比例,必填项</p></li><li><p>min_similars:&ldquo;梭形相似点"的最少个数,只有当起点的"梭形相似点"数目大于或等于该值时,才会返回起点及其"梭形相似点&rdquo;,选填项,默认值为1</p></li><li><p>top:返回一个起点的"梭形相似点"中相似度最高的top个,必填项,0表示全部</p></li><li><p>group_property:与<code>min_groups</code>一起使用,当起点跟其所有的"梭形相似点"某个属性的值有至少<code>min_groups</code>个不同值时,才会返回该起点及其"梭形相似点"。比如为"读者A"推荐"异地"书友时,需要设置<code>group_property</code>为读者的"城市"属性,<code>min_group</code>至少为2,选填项,不填代表不需要根据属性过滤</p></li><li><p>min_groups:与<code>group_property</code>一起使用,只有<code>group_property</code>设置时才有意义</p></li><li><p>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,选填项,默认为10000</p></li><li><p>capacity:遍历过程中最大的访问的顶点数目,选填项,默认为10000000</p></li><li><p>limit:返回的结果数目上限(一个起点及其"梭形相似点"算一个结果),选填项,默认为10</p></li><li><p>with_intermediary:是否返回起点及其"梭形相似点"共同关联的中间点,默认为false</p></li><li><p>with_vertex,选填项,默认为false:</p><ul><li>true表示返回结果包含完整的顶点信息</li><li>false时表示只返回顶点id</li></ul></li></ul><h5 id=32212-使用方法>3.2.21.2 使用方法</h5><h6 id=method--url-20>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/traversers/fusiformsimilarity
</span></span></code></pre></div><h6 id=request-body-8>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sources&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ids&#34;</span><span style=color:#000;font-weight:700>:[],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;p1&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;read&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min_neighbors&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;alpha&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.75</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min_similars&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;top&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_property&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min_group&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_intermediary&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_vertex&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-20>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-20>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;similars&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;3:p1&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3:p2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;score&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.8888888888888888</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;intermediaries&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3:p3&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;score&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.7777777777777778</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;intermediaries&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3:p1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;p1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3:p2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;p2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3:p3&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;p3&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32213-适用场景>3.2.21.3 适用场景</h5><p>查询一组顶点相似度很高的顶点。例如:</p><ul><li>跟一个读者有类似书单的读者</li><li>跟一个玩家玩类似游戏的玩家</li></ul><h4 id=3222-vertices>3.2.22 Vertices</h4><h5 id=32221-根据顶点的id列表批量查询顶点>3.2.22.1 根据顶点的id列表,批量查询顶点</h5><h6 id=params-21>Params</h6><ul><li>ids:要查询的顶点id列表</li></ul><h6 id=method--url-21>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/vertices?ids=&#34;1:marko&#34;&amp;ids=&#34;2:lop&#34;
</span></span></code></pre></div><h6 id=response-status-21>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-21>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32222-获取顶点-shard-信息>3.2.22.2 获取顶点 Shard 信息</h5><p>通过指定的分片大小split_size,获取顶点分片信息(可以与 3.2.21.3 中的 Scan 配合使用来获取顶点)。</p><h6 id=params-22>Params</h6><ul><li>split_size:分片大小,必填项</li></ul><h6 id=method--url-22>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/vertices/shards?split_size=67108864
</span></span></code></pre></div><h6 id=response-status-22>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-22>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;shards&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2165893&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2165893&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4331786&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4331786&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;6497679&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;6497679&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;8663572&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#a40000>......</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32223-根据shard信息批量获取顶点>3.2.22.3 根据Shard信息批量获取顶点</h5><p>通过指定的分片信息批量查询顶点(Shard信息的获取参见 3.2.21.2 Shard)。</p><h6 id=params-23>Params</h6><ul><li>start:分片起始位置,必填项</li><li>end:分片结束位置,必填项</li><li>page:分页位置,选填项,默认为null,不分页;当page为“”时表示分页的第一页,从start指示的位置开始</li><li>page_limit:分页获取顶点时,一页中顶点数目的上限,选填项,默认为100000</li></ul><h6 id=method--url-23>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/vertices/scan?start=0&amp;end=4294967295
</span></span></code></pre></div><h6 id=response-status-23>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-23>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>199</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;ripple&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Hongkong&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vadas&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>27</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Shanghai&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;peter&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>35</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;josh&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>32</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;price&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;price&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>328</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;lop&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;lang&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&gt;lang&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;java&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32224-适用场景>3.2.22.4 适用场景</h5><ul><li>按id列表查询顶点,可用于批量查询顶点,比如在path查询到多条路径之后,可以进一步查询某条路径的所有顶点属性。</li><li>获取分片和按分片查询顶点,可以用来遍历全部顶点</li></ul><h4 id=3223-edges>3.2.23 Edges</h4><h5 id=32231-根据边的id列表批量查询边>3.2.23.1 根据边的id列表,批量查询边</h5><h6 id=params-24>Params</h6><ul><li>ids:要查询的边id列表</li></ul><h6 id=method--url-24>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/edges?ids=&#34;S1:josh&gt;1&gt;&gt;S2:lop&#34;&amp;ids=&#34;S1:josh&gt;1&gt;&gt;S2:ripple&#34;
</span></span></code></pre></div><h6 id=response-status-24>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-24>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:josh&gt;1&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20091111&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:josh&gt;1&gt;&gt;S2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32232-获取边-shard-信息>3.2.23.2 获取边 Shard 信息</h5><p>通过指定的分片大小split_size,获取边分片信息(可以与 3.2.22.3 中的 Scan 配合使用来获取边)。</p><h6 id=params-25>Params</h6><ul><li>split_size:分片大小,必填项</li></ul><h6 id=method--url-25>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/edges/shards?split_size=4294967295
</span></span></code></pre></div><h6 id=response-status-25>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-25>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;shards&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1073741823&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1073741823&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2147483646&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2147483646&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3221225469&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3221225469&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4294967292&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;start&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4294967292&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;end&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;4294967295&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;length&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32233-根据-shard-信息批量获取边>3.2.23.3 根据 Shard 信息批量获取边</h5><p>通过指定的分片信息批量查询边(Shard信息的获取参见 3.2.22.2)。</p><h6 id=params-26>Params</h6><ul><li>start:分片起始位置,必填项</li><li>end:分片结束位置,必填项</li><li>page:分页位置,选填项,默认为null,不分页;当page为“”时表示分页的第一页,从start指示的位置开始</li><li>page_limit:分页获取边时,一页中边数目的上限,选填项,默认为100000</li></ul><h6 id=method--url-26>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/traversers/edges/scan?start=0&amp;end=3221225469
</span></span></code></pre></div><h6 id=response-status-26>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-26>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:peter&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:peter&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20170324&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:josh&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20091111&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:josh&gt;2&gt;&gt;S2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:ripple&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;20130220&gt;S1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:josh&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20130220&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:marko&gt;1&gt;20160110&gt;S1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:vadas&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20160110&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=32234-适用场景>3.2.23.4 适用场景</h5><ul><li>按id列表查询边,可用于批量查询边</li><li>获取分片和按分片查询边,可以用来遍历全部边</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-ced5167413a6606a537e40b18f6fec3e>5.1.10 - Rank API</h1><h3 id=41-rank-api-概述>4.1 rank API 概述</h3><p>HugeGraphServer 除了上一节提到的遍历(traverser)方法,还提供了一类专门做推荐的方法,我们称为<code>rank API</code>
可在图中为一个点推荐与其关系密切的其它点。</p><h3 id=42-rank-api-详解>4.2 rank API 详解</h3><h4 id=421-personal-rank-api>4.2.1 Personal Rank API</h4><p>Personal Rank 算法典型场景是用于推荐应用中, 根据某个点现有的出边, 推荐具有相近 / 相同关系的其他点,
比如根据某个人的阅读记录 / 习惯, 向它推荐其他可能感兴趣的书, 或潜在的书友, 举例如下:</p><ol><li>假设给定 1个 Person 点 是 tom, 它喜欢 <code>a,b,c,d,e</code> 5本书, 我们的想给 tom 推荐一些书友, 以及一些书, 最容易的想法就是看看还有哪些人喜欢过这些书 (共同兴趣)</li><li>那么此时, 需要有其它的 Person 点比如 neo, 他喜欢 <code>b,d,f</code> 3本书, 以及 jay, 它喜欢 <code>c,d,e,g</code> 4本书, lee 它喜欢 <code>a,d,e,f</code> 4本书</li><li>由于 tom 已经看过的书不需要重复推荐, 所以返回结果里应该期望推荐有共同喜好的其他书友看过, 但 tom 没看过的书, 比如推荐 &ldquo;f&rdquo; 和 &ldquo;g&rdquo; 书, 且优先级 f > g</li><li>此时再计算 tom 的个性化 rank 值, 就会返回排序后 TopN 推荐的 书友 + 书 的结果了 (如果只需要推荐的书, 选择 OTHER_LABEL 即可)</li></ol><h5 id=4210-数据准备>4.2.1.0 数据准备</h5><p>上面是一个简单的例子, 这里再提供一个公开的 1MB 测试数据集 <a href=https://grouplens.org/datasets/movielens/>MovieLens</a> 为例,
用户需下载该数据集,然后使用 HugeGraph-Loader 导入到 HugeGraph 中,简单起见,数据中顶点 user
和 movie 的属性都忽略,仅使用 id 字段即可,边 rating 的具体评分值也忽略。loader 使用的元数据
文件和输入源映射文件内容如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#8f5902;font-style:italic>////////////////////////////////////////////////////////////
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// UserID::Gender::Age::Occupation::Zip-code
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// MovieID::Title::Genres
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// UserID::MovieID::Rating::Timestamp
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>////////////////////////////////////////////////////////////
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// Define schema
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;rate&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;user&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;rating&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;user&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;rate&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;vertices&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;user&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;users.dat&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;::&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;UserID&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Gender&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Age&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Occupation&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Zip-code&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;Gender&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Age&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Occupation&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Zip-code&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;UserID&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;id&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;movies.dat&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;::&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;MovieID&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Title&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Genres&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;Title&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Genres&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MovieID&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;id&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;edges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rating&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;UserID&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;MovieID&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;file&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;path&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ratings.dat&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;format&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;TEXT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;delimiter&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;::&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;header&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;UserID&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;MovieID&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Rating&#34;</span><span style=color:#000;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Timestamp&#34;</span><span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ignored&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span><span style=color:#4e9a06>&#34;Timestamp&#34;</span><span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mapping&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;UserID&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MovieID&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;Rating&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rate&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>注意将映射文件中<code>input.path</code>的值修改为自己本地的路径。</p></blockquote><h5 id=4211-功能介绍>4.2.1.1 功能介绍</h5><p>适用于二分图,给出所有源顶点相关的其他顶点及其相关性组成的列表。</p><blockquote><p>二分图:也称二部图,是图论里的一种特殊模型,也是一种特殊的网络流。其最大的特点在于,可以将图里的顶点分为两个集合,两个集合之间的点有边相连,但集合内的点之间没有直接关联。</p></blockquote><p>假设有一个用户和物品的二分图,基于随机游走的 PersonalRank 算法步骤如下:</p><ol><li>选定一个起点用户 u,其初始权重为 1.0,从 Vu 开始游走(有 alpha 的概率走到邻居点,1 - alpha 的概率停留);</li><li>如果决定向外游走, 那么会选取某一个类型的出边, 例如 <code>rating</code> 来查找共同的打分人:<ol><li>那就从当前节点的邻居节点中按照均匀分布随机选择一个,并且按照均匀分布划分权重值;</li><li>给源顶点补偿权重 1 - alpha;</li><li>重复步骤2;</li></ol></li><li>达到一定步数或达到精度后收敛,得到推荐列表。</li></ol><h6 id=params>Params</h6><p><strong>必填项</strong>:</p><ul><li>source: 源顶点 id</li><li>label: 源点出发的某类边 label,须连接两类不同顶点</li></ul><p><strong>选填项</strong>:</p><ul><li>alpha:每轮迭代时从某个点往外走的概率,与 PageRank 算法中的 alpha 类似,取值区间为 (0, 1], 默认值 <code>0.85</code></li><li>max_degree: 查询过程中,单个顶点遍历的最大邻接边数目,默认为 <code>10000</code></li><li>max_depth: 迭代次数,取值区间为 [2, 50], 默认值 <code>5</code></li><li>with_label:筛选结果中保留哪些结果,可选以下三类, 默认为 <code>BOTH_LABEL</code><ul><li>SAME_LABEL:仅保留与源顶点相同类别的顶点</li><li>OTHER_LABEL:仅保留与源顶点不同类别(二分图的另一端)的顶点</li><li>BOTH_LABEL:同时保留与源顶点相同和相反类别的顶点</li></ul></li><li>limit: 返回的顶点的最大数目,默认为 <code>100</code></li><li>max_diff: 提前收敛的精度差, 默认为 <code>0.0001</code> (<em>后续实现</em>)</li><li>sorted:返回的结果是否根据 rank 排序,为 true 时降序排列,反之不排序,默认为 <code>true</code></li></ul><h5 id=4212-使用方法>4.2.1.2 使用方法</h5><h6 id=method--url>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/traversers/personalrank
</span></span></code></pre></div><h6 id=request-body>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rating&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;alpha&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_depth&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>15</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;with_label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OTHER_LABEL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;sorted&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;limit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:2858&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0005014026017816927</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:1196&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0004336708357653617</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:1210&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0004128083140214213</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:593&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.00038117341069881513</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:480&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.00037005373269728036</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:1198&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.000366641614652057</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:2396&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0003622362410538888</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:2571&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0003593312457300953</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:589&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.00035922123055598566</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;2:110&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0003466135844390885</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=4213-适用场景>4.2.1.3 适用场景</h5><p>两类不同顶点连接形成的二分图中,给某个点推荐相关性最高的其他顶点,例如:</p><ul><li>阅读推荐: 找出优先给某人推荐的其他<strong>书籍</strong>, 也可以同时推荐共同喜好最高的<strong>书友</strong> (例: 微信 &ldquo;你的好友也在看 xx 文章&rdquo; 功能)</li><li>社交推荐: 找出拥有相同关注话题的其他<strong>博主</strong>, 也可以推荐可能感兴趣的<strong>新闻/消息</strong> (例: Weibo 中的 &ldquo;热点推荐&rdquo; 功能)</li><li>商品推荐: 通过某人现在的购物习惯, 找出应优先推给它的<strong>商品列表</strong>, 也可以给它推荐<strong>带货</strong>播主 (例: TaoBao 的 &ldquo;猜你喜欢&rdquo; 功能)</li></ul><h4 id=422-neighbor-rank-api>4.2.2 Neighbor Rank API</h4><h5 id=4220-数据准备>4.2.2.0 数据准备</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>Loader</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>[]</span> <span style=color:#000>args</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>HugeClient</span> <span style=color:#000>client</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;http://127.0.0.1:8080&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>SchemaManager</span> <span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>client</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>useCustomizeStringId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>useCustomizeStringId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;directedBy&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>GraphManager</span> <span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>client</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>graph</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>O</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;O&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;O&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>A</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;A&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;A&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>B</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;B&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;B&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>C</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;C&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;C&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>D</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;D&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;D&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>E</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;E&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;E&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>F</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;F&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;F&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>G</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;G&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;G&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>H</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;H&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;H&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>I</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;I&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;I&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>J</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;movie&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;J&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;J&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>K</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;K&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;K&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>L</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;L&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;L&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>M</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;M&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;M&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>O</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>A</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>O</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>B</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>O</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>C</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>D</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>O</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>A</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>B</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>A</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>E</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>A</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>F</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>B</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>G</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>B</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>H</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>C</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>I</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>C</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;like&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>J</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>E</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;directedBy&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>K</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>F</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;directedBy&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>B</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>F</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;directedBy&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>L</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>G</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;directedBy&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>M</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=4221-功能介绍>4.2.2.1 功能介绍</h5><p>在一般图结构中,找出每一层与给定起点相关性最高的前 N 个顶点及其相关度,用图的语义理解就是:从起点往外走,
走到各层各个顶点的概率。</p><h6 id=params-1>Params</h6><ul><li>source: 源顶点 id,必填项</li><li>alpha:每轮迭代时从某个点往外走的概率,与 PageRank 算法中的 alpha 类似,必填项,取值区间为 (0, 1]</li><li>steps: 表示从起始顶点走过的路径规则,是一组 Step 的列表,每个 Step 对应结果中的一层,必填项。每个 Step 的结构如下:<ul><li>direction:表示边的方向(OUT, IN, BOTH),默认是 BOTH</li><li>labels:边的类型列表,多个边类型取并集</li><li>max_degree:查询过程中,单个顶点遍历的最大邻接边数目,默认为 10000 (注: 0.12版之前 step 内仅支持 degree 作为参数名, 0.12开始统一使用 max_degree, 并向下兼容 degree 写法)</li><li>top:在结果中每一层只保留权重最高的前 N 个结果,默认为 100,最大值为 1000</li></ul></li><li>capacity: 遍历过程中最大的访问的顶点数目,选填项,默认为10000000</li></ul><h5 id=4222-使用方法>4.2.2.2 使用方法</h5><h6 id=method--url-1>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/traversers/neighborrank
</span></span></code></pre></div><h6 id=request-body-1>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;source&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;O&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;steps&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;follow&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;top&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>100</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;follow&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;like&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;top&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>100</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;direction&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#4e9a06>&#34;OUT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;labels&#34;</span><span style=color:#000;font-weight:700>:[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;directedBy&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max_degree&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;top&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>100</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;alpha&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>0.9</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;capacity&#34;</span><span style=color:#000;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>-1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=response-status-1>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-1>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ranks&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;O&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;B&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4305</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;A&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;C&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.3</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;G&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.17550000000000002</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;H&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.17550000000000002</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;I&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.135</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;J&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.135</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;E&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.09000000000000001</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;F&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.09000000000000001</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;M&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.15795</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;K&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.08100000000000002</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;L&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.04050000000000001</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=4223-适用场景>4.2.2.3 适用场景</h5><p>为给定的起点在不同的层中找到最应该推荐的顶点。</p><ul><li>比如:在观众、朋友、电影、导演的四层图结构中,根据某个观众的朋友们喜欢的电影,为这个观众推荐电影;或者根据这些电影是谁拍的,为其推荐导演。</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-32aff6fa72d51caa846c2a72e5771c5d>5.1.11 - Variable API</h1><h3 id=51-variables>5.1 Variables</h3><p>Variables可以用来存储有关整个图的数据,数据按照键值对的方式存取</p><h4 id=511-创建或者更新某个键值对>5.1.1 创建或者更新某个键值对</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/variables/name
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;tom&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;tom&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=512-列出全部键值对>5.1.2 列出全部键值对</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/variables
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;tom&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=513-列出某个键值对>5.1.3 列出某个键值对</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/variables/name
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;tom&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=514-删除某个键值对>5.1.4 删除某个键值对</h4><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/variables/name
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-3d75cf337650cd90a617c3ef7e9dca87>5.1.12 - Graphs API</h1><h3 id=61-graphs>6.1 Graphs</h3><h4 id=611-列出数据库中全部的图>6.1.1 列出数据库中全部的图</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;graphs&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph1&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=612-查看某个图的信息>6.1.2 查看某个图的信息</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;backend&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;cassandra&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=613-清空某个图的全部数据包括-schemavertexedge-和-index-等该操作需要管理员权限>6.1.3 清空某个图的全部数据,包括 schema、vertex、edge 和 index 等,<strong>该操作需要管理员权限</strong></h4><h5 id=params>Params</h5><p>由于清空图是一个比较危险的操作,为避免用户误调用,我们给 API 添加了用于确认的参数:</p><ul><li>confirm_message: 默认为<code>I'm sure to delete all data</code></li></ul><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/clear?confirm_message=I%27m+sure+to+delete+all+data
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h4 id=614-克隆一个图该操作需要管理员权限>6.1.4 克隆一个图,<strong>该操作需要管理员权限</strong></h4><h5 id=params-1>Params</h5><ul><li>clone_graph_name: 已有图的名称;从已有的图来克隆,用户可选择传递配置文件,传递时将替换已有图中的配置;</li></ul><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph_clone?clone_graph_name=hugegraph
</span></span></code></pre></div><h5 id=request-body可选>Request Body【可选】</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy
</span></span><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>store=hugegraph_clone
</span></span><span style=display:flex><span>rocksdb.data_path=./rks-data-xx
</span></span><span style=display:flex><span>rocksdb.wal_path=./rks-data-xx
</span></span></code></pre></div><blockquote><p>Note: 存储路径不能与现有图相同(使用不同的目录)</p></blockquote><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph_clone&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;backend&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rocksdb&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=615-创建一个图该操作需要管理员权限>6.1.5 创建一个图,<strong>该操作需要管理员权限</strong></h4><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph-xx
</span></span></code></pre></div><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>gremlin.graph=org.apache.hugegraph.auth.HugeFactoryAuthProxy
</span></span><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>store=hugegraph2
</span></span><span style=display:flex><span>rocksdb.data_path=./rks-data-xx
</span></span><span style=display:flex><span>rocksdb.wal_path=./rks-data-xx
</span></span></code></pre></div><blockquote><p>Note: 存储路径不能与现有图相同(使用不同的目录)</p></blockquote><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph2&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;backend&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rocksdb&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=616-删除某个图及其全部数据>6.1.6 删除某个图及其全部数据</h4><h5 id=params-2>Params</h5><p>由于删除图是一个比较危险的操作,为避免用户误调用,我们给 API 添加了用于确认的参数:</p><ul><li>confirm_message: 默认为<code>I'm sure to drop the graph</code></li></ul><h5 id=method--url-5>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph_clone?confirm_message=I%27m%20sure%20to%20drop%20the%20graph
</span></span></code></pre></div><h5 id=response-status-5>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h3 id=62-conf>6.2 Conf</h3><h4 id=621-查看某个图的配置该操作需要管理员权限>6.2.1 查看某个图的配置,<strong>该操作需要管理员权限</strong></h4><h5 id=method--url-6>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/conf
</span></span></code></pre></div><h5 id=response-status-6>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span># gremlin entrence to create graph
</span></span><span style=display:flex><span>gremlin.graph=org.apache.hugegraph.HugeFactory
</span></span><span style=display:flex><span># cache config
</span></span><span style=display:flex><span>#schema.cache_capacity=1048576
</span></span><span style=display:flex><span>#graph.cache_capacity=10485760
</span></span><span style=display:flex><span>#graph.cache_expire=600
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span># schema illegal name template
</span></span><span style=display:flex><span>#schema.illegal_name_regex=\s+|~.*
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>#vertex.default_label=vertex
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>backend=cassandra
</span></span><span style=display:flex><span>serializer=cassandra
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>store=hugegraph
</span></span><span style=display:flex><span>...=
</span></span></code></pre></div><h3 id=63-mode>6.3 Mode</h3><p>合法的图模式包括:NONE,RESTORING,MERGING,LOADING</p><ul><li>None 模式(默认),元数据和图数据的写入属于正常状态。特别的:<ul><li>元数据(schema)创建时不允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,不允许指定 ID</li></ul></li><li>LOADING:批量导入数据时自动启用,特别的:<ul><li>添加顶点/边时,不会检查必填属性是否传入</li></ul></li></ul><p>Restore 时存在两种不同的模式:Restoring 和 Merging</p><ul><li>Restoring 模式,恢复到一个新图中,特别的:<ul><li>元数据(schema)创建时允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,允许指定 ID</li></ul></li><li>Merging 模式,合并到一个已存在元数据和图数据的图中,特别的:<ul><li>元数据(schema)创建时不允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,允许指定 ID</li></ul></li></ul><p>正常情况下,图模式为 None,当需要 Restore 图时,需要根据需要临时修改图模式为 Restoring 模式或者 Merging
模式,并在完成 Restore 时,恢复图模式为 None。</p><h4 id=631-查看某个图的模式>6.3.1 查看某个图的模式。</h4><h5 id=method--url-7>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/mode
</span></span></code></pre></div><h5 id=response-status-7>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-5>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;mode&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>合法的图模式包括:NONE,RESTORING,MERGING</p></blockquote><h4 id=632-设置某个图的模式该操作需要管理员权限>6.3.2 设置某个图的模式。<strong>该操作需要管理员权限</strong></h4><h5 id=method--url-8>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/mode
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>&#34;RESTORING&#34;
</span></span></code></pre></div><blockquote><p>合法的图模式包括:NONE,RESTORING,MERGING</p></blockquote><h5 id=response-status-8>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-6>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;mode&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RESTORING&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=633-查看某个图的读模式>6.3.3 查看某个图的读模式。</h4><h5 id=params-3>Params</h5><ul><li>name: 图的名称</li></ul><h5 id=method--url-9>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/graph_read_mode
</span></span></code></pre></div><h5 id=response-status-9>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-7>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;graph_read_mode&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ALL&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=634-设置某个图的读模式该操作需要管理员权限>6.3.4 设置某个图的读模式。<strong>该操作需要管理员权限</strong></h4><h5 id=params-4>Params</h5><ul><li>name: 图的名称</li></ul><h5 id=method--url-10>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/graph_read_mode
</span></span></code></pre></div><h5 id=request-body-2>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>&#34;OLTP_ONLY&#34;
</span></span></code></pre></div><blockquote><p>合法的图模式包括:ALL,OLTP_ONLY,OLAP_ONLY</p></blockquote><h5 id=response-status-10>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-8>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;graph_read_mode&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OLTP_ONLY&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=64-snapshot>6.4 Snapshot</h3><h4 id=641-创建快照>6.4.1 创建快照</h4><h5 id=params-5>Params</h5><ul><li>name: 图的名称</li></ul><h5 id=method--url-11>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/snapshot_create
</span></span></code></pre></div><h5 id=response-status-11>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-9>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;snapshot_created&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=642-快照恢复>6.4.2 快照恢复</h4><h5 id=params-6>Params</h5><ul><li>name: 图的名称</li></ul><h5 id=method--url-12>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/snapshot_resume
</span></span></code></pre></div><h5 id=response-status-12>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-10>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;snapshot_resumed&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=65-compact>6.5 Compact</h3><h4 id=651-手动压缩图该操作需要管理员权限>6.5.1 手动压缩图,<strong>该操作需要管理员权限</strong></h4><h5 id=params-7>Params</h5><ul><li>name: 图的名称</li></ul><h5 id=method--url-13>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/compact
</span></span></code></pre></div><h5 id=response-status-13>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-11>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;nodes&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;cluster_id&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;local&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;servers&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;local&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;OK&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-d9de752e44e3a8a709d187e4101fd818>5.1.13 - Task API</h1><h3 id=71-task>7.1 Task</h3><h4 id=711-列出某个图中全部的异步任务>7.1.1 列出某个图中全部的异步任务</h4><h5 id=params>Params</h5><ul><li>status: 异步任务的状态</li><li>limit:返回异步任务数目上限</li></ul><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/tasks?status=success
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;tasks&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph.traversal().V()&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_progress&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1532943976585</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;success&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1532943976736</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_result&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_retries&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_callable&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;org.apache.hugegraph.api.job.GremlinAPI$GremlinJob&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;{\&#34;gremlin\&#34;:\&#34;hugegraph.traversal().V()\&#34;,\&#34;bindings\&#34;:{},\&#34;language\&#34;:\&#34;gremlin-groovy\&#34;,\&#34;aliases\&#34;:{\&#34;hugegraph\&#34;:\&#34;graph\&#34;}}&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=712-查看某个异步任务的信息>7.1.2 查看某个异步任务的信息</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/tasks/2
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph.traversal().V()&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_progress&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1532943976585</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;success&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1532943976736</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_result&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_retries&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_callable&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;org.apache.hugegraph.api.job.GremlinAPI$GremlinJob&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_input&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;{\&#34;gremlin\&#34;:\&#34;hugegraph.traversal().V()\&#34;,\&#34;bindings\&#34;:{},\&#34;language\&#34;:\&#34;gremlin-groovy\&#34;,\&#34;aliases\&#34;:{\&#34;hugegraph\&#34;:\&#34;graph\&#34;}}&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=713-删除某个异步任务信息不删除异步任务本身>7.1.3 删除某个异步任务信息,<strong>不删除异步任务本身</strong></h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/tasks/2
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h4 id=714-取消某个异步任务该异步任务必须具有处理中断的能力>7.1.4 取消某个异步任务,<strong>该异步任务必须具有处理中断的能力</strong></h4><p>假设已经通过<a href=../gremlin>Gremlin API</a>创建了一个异步任务如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#4e9a06>&#34;for (int i = 0; i &lt; 10; i++) {&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph.addVertex(T.label, &#39;man&#39;);&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;hugegraph.tx().commit();&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;try {&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;sleep(1000);&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;} catch (InterruptedException e) {&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;break;&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;}&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span><span style=color:#4e9a06>&#34;}&#34;</span>
</span></span></code></pre></div><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/tasks/2?action=cancel
</span></span></code></pre></div><blockquote><p>请保证在 10 秒内发送该请求,如果超过 10 秒发送,任务可能已经执行完成,无法取消。</p></blockquote><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>202</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cancelled&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>true</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>此时查询 label 为 man 的顶点数目,一定是小于 10 的。</p></div><div class=td-content style=page-break-before:always><h1 id=pg-e84b0f106294b580ca64918b72cc71d1>5.1.14 - Gremlin API</h1><h3 id=81-gremlin>8.1 Gremlin</h3><h4 id=811-向hugegraphserver发送gremlin语句get同步执行>8.1.1 向HugeGraphServer发送gremlin语句(GET),同步执行</h4><h5 id=params>Params</h5><ul><li>gremlin: 要发送给<code>HugeGraphServer</code>执行的<code>gremlin</code>语句</li><li>bindings: 用来绑定参数,key是字符串,value是绑定的值(只能是字符串或者数字),功能类似于MySQL的 Prepared Statement,用于加速语句执行</li><li>language: 发送语句的语言类型,默认为<code>gremlin-groovy</code></li><li>aliases: 为存在于图空间的已有变量添加别名</li></ul><p><strong>查询顶点</strong></p><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://127.0.0.1:8080/gremlin?gremlin=hugegraph.traversal().V(&#39;1:marko&#39;)
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;requestId&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;c6ef47a8-b634-4b07-9d38-6b3b69a3a556&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;message&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;code&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>200</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;attributes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;result&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;meta&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=812-向hugegraphserver发送gremlin语句post同步执行>8.1.2 向HugeGraphServer发送gremlin语句(POST),同步执行</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/gremlin
</span></span></code></pre></div><p><strong>查询顶点</strong></p><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph.traversal().V(&#39;1:marko&#39;)&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;bindings&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;language&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin-groovy&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aliases&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;requestId&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;c6ef47a8-b634-4b07-9d38-6b3b69a3a556&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;message&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;code&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>200</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;attributes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;result&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;vertex&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;city&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;city&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;name&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;marko&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;age&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&gt;age&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>29</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;meta&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注意:</p><blockquote><p>这里是直接使用图对象(hugegraph),先获取其遍历器(traversal()),再获取顶点。
不能直接写成<code>graph.traversal().V()</code><code>g.V()</code>,可以通过<code>"aliases": {"graph": "hugegraph", "g": "__g_hugegraph"}</code>
为图和遍历器添加别名后使用别名操作。其中,<code>hugegraph</code>是原生存在的变量,<code>__g_hugegraph</code><code>HugeGraphServer</code>额外添加的变量,
每个图都会存在一个对应的这样格式(_<em>g</em>${graph})的遍历器对象。</p></blockquote><blockquote><p>响应体的结构与其他 Vertex 或 Edge 的 RESTful API的结构有区别,用户可能需要自行解析。</p></blockquote><p><strong>查询边</strong></p><h5 id=request-body-1>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;g.E(&#39;S1:marko&gt;2&gt;&gt;S2:lop&#39;)&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;bindings&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;language&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin-groovy&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aliases&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;g&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;__g_hugegraph&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;requestId&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3f117cd4-eedc-4e08-a106-ee01d7bb8249&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;status&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;message&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;code&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>200</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;attributes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;result&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;data&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S1:marko&gt;2&gt;&gt;S2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;edge&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outVLabel&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;inV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2:lop&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;outV&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;1:marko&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.4</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;date&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;20171210&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;meta&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=813-向hugegraphserver发送gremlin语句post异步执行>8.1.3 向HugeGraphServer发送gremlin语句(POST),异步执行</h4><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/jobs/gremlin
</span></span></code></pre></div><p><strong>查询顶点</strong></p><h5 id=request-body-2>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;g.V(&#39;1:marko&#39;)&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;bindings&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;language&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin-groovy&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aliases&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注意:</p><blockquote><p>异步执行Gremlin语句暂不支持aliases,可以使用 <code>graph</code> 代表要操作的图,也可以直接使用图的名字, 例如 <code>hugegraph</code>;
另外<code>g</code>代表 traversal,等价于 <code>graph.traversal()</code> 或者 <code>hugegraph.traversal()</code></p></blockquote><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/1</code>(其中"1"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote><p><strong>查询边</strong></p><h5 id=request-body-3>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;g.E(&#39;S1:marko&gt;2&gt;&gt;S2:lop&#39;)&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;bindings&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;language&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin-groovy&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;aliases&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;task_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><p>注:</p><blockquote><p>可以通过<code>GET http://localhost:8080/graphs/hugegraph/tasks/2</code>(其中"2"是task_id)来查询异步任务的执行状态,更多<a href=../task>异步任务RESTful API</a></p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-f7fe8b1685038d0062b4c806247e1db4>5.1.15 - Cypher API</h1><h3 id=91-cypher>9.1 Cypher</h3><h4 id=911-向hugegraphserver发送cypher语句get同步执行>9.1.1 向HugeGraphServer发送Cypher语句(GET),同步执行</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000>GET</span> <span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>graphs</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000;font-weight:700>{</span><span style=color:#000>graph</span><span style=color:#000;font-weight:700>}</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>cypher</span><span style=color:#ce5c00;font-weight:700>?</span><span style=color:#000>cypher</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#000;font-weight:700>{</span><span style=color:#000>cypher</span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=params>Params</h5><ul><li>graph: 图名称</li><li>cypher: cypher语句</li></ul><h5 id=使用示例>使用示例</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000>GET</span> <span style=color:#000>http</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#8f5902;font-style:italic>//localhost:8080/graphs/hugecypher1/cypher?cypher=match(n:person) return n.name as name order by n.name limit 1
</span></span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;requestId&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;766b9f48-2f10-40d9-951a-3027d0748ab7&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;status&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;message&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;code&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>200</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;attributes&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;result&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;data&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hello&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;meta&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=912-向hugegraphserver发送cypher语句post同步执行>9.1.2 向HugeGraphServer发送Cypher语句(POST),同步执行</h4><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000>POST</span> <span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>graphs</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000;font-weight:700>{</span><span style=color:#000>graph</span><span style=color:#000;font-weight:700>}</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>cypher</span>
</span></span></code></pre></div><h5 id=params-1>Params</h5><ul><li>graph: 图名称</li></ul><h5 id=body>Body</h5><p>{cypher}</p><ul><li>cypher: cypher语句</li></ul><p>注意:</p><blockquote><p>不是JSON格式,是纯文本的Cypher语句</p></blockquote><h5 id=使用示例-1>使用示例</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000>POST</span> <span style=color:#000>http</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#8f5902;font-style:italic>//localhost:8080/graphs/hugecypher1/cypher
</span></span></span></code></pre></div><h6 id=request-body>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>match(n:person) return n.name as name order by n.name limit 1
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-javascript data-lang=javascript><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;requestId&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;f096bee0-e249-498f-b5a3-ea684fc84f57&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;status&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;message&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;code&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>200</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;attributes&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;result&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;data&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hello&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;meta&#34;</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-a3b125f257052209fcb98300d5c066a7>5.1.16 - Authentication API</h1><h3 id=101-用户认证与权限控制>10.1 用户认证与权限控制</h3><blockquote><p>开启权限及相关配置请先参考 <a href=/cn/docs/config/config-authentication/>权限配置</a> 文档</p></blockquote><h5 id=用户认证与权限控制概述>用户认证与权限控制概述:</h5><p>HugeGraph 支持多用户认证、以及细粒度的权限访问控制,采用基于“用户 - 用户组 - 操作 - 资源”的 4 层设计,灵活控制用户角色与权限。
资源描述了图数据库中的数据,比如符合某一类条件的顶点,每一个资源包括 type、label、properties 三个要素,共有 18 种 type、
任意 label、任意 properties 的组合形成的资源,一个资源的内部条件是且关系,多个资源之间的条件是或关系。用户可以属于一个或多个用户组,
每个用户组可以拥有对任意个资源的操作权限,操作类型包括:读、写、删除、执行等种类。HugeGraph 支持动态创建用户、用户组、资源,
支持动态分配或取消权限。初始化数据库时超级管理员用户被创建,后续可通过超级管理员创建各类角色用户,新创建的用户如果被分配足够权限后,可以由其创建或管理更多的用户。</p><h5 id=举例说明>举例说明:</h5><p>user(name=boss) -belong-> group(name=all) -access(read)-> target(graph=graph1, resource={label: person,
city: Beijing})<br>描述:用户&rsquo;boss&rsquo;拥有对&rsquo;graph1&rsquo;图中北京人的读权限。</p><h5 id=接口说明>接口说明:</h5><p>用户认证与权限控制接口包括 5 类:UserAPI、GroupAPI、TargetAPI、BelongAPI、AccessAPI。</p><h3 id=102-用户userapi>10.2 用户(User)API</h3><p>用户接口包括:创建用户,删除用户,修改用户,和查询用户相关信息接口。</p><h4 id=1021-创建用户>10.2.1 创建用户</h4><h5 id=params>Params</h5><ul><li>user_name: 用户名称</li><li>user_password: 用户密码</li><li>user_phone: 用户手机号</li><li>user_email: 用户邮箱</li></ul><p>其中 user_name 和 user_password 为必填。</p><h5 id=request-body>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_phone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;182****9088&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_email&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;123@xx.com&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/auth/users
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><p>返回报文中,密码为加密后的密文</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_email&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;123@xx.com&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-17 14:31:07.833&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_phone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;182****9088&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-17 14:31:07.833&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1022-删除用户>10.2.2 删除用户</h4><h5 id=params-1>Params</h5><ul><li>id: 需要删除的用户 Id</li></ul><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/auth/users/-63:test
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>1</span>
</span></span></code></pre></div><h4 id=1023-修改用户>10.2.3 修改用户</h4><h5 id=params-2>Params</h5><ul><li>id: 需要修改的用户 Id</li></ul><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/auth/users/-63:test
</span></span></code></pre></div><h5 id=request-body-1>Request Body</h5><p>修改 user_name、user_password 和 user_phone</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;test&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_phone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;183****9266&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><p>返回结果是包含修改过的内容在内的整个用户组对象</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:29:30.455&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;test&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_phone&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;183****9266&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:test&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:27:13.601&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1024-查询用户列表>10.2.4 查询用户列表</h4><h5 id=params-3>Params</h5><ul><li>limit: 返回结果条数的上限</li></ul><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/users
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;users&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 11:41:12.254&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;system&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 11:41:12.254&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1025-查询某个用户>10.2.5 查询某个用户</h4><h5 id=params-4>Params</h5><ul><li>id: 需要查询的用户 Id</li></ul><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/users/-63:admin
</span></span></code></pre></div><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;users&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_password&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;******&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 11:41:12.254&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;system&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 11:41:12.254&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1026-查询某个用户的角色>10.2.6 查询某个用户的角色</h4><h5 id=method--url-5>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/users/-63:boss/role
</span></span></code></pre></div><h5 id=response-status-5>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-5>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;roles&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;READ&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ALL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=103-用户组groupapi>10.3 用户组(Group)API</h3><p>用户组会赋予相应的资源权限,用户会被分配不同的用户组,即可拥有不同的资源权限。<br>用户组接口包括:创建用户组,删除用户组,修改用户组,和查询用户组相关信息接口。</p><h4 id=1031-创建用户组>10.3.1 创建用户组</h4><h5 id=params-5>Params</h5><ul><li>group_name: 用户组名称</li><li>group_description: 用户组描述</li></ul><h5 id=request-body-2>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;group can do anything&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=method--url-6>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/auth/groups
</span></span></code></pre></div><h5 id=response-status-6>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-6>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;group can do anything&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1032-删除用户组>10.3.2 删除用户组</h4><h5 id=params-6>Params</h5><ul><li>id: 需要删除的用户组 Id</li></ul><h5 id=method--url-7>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/auth/groups/-69:grant
</span></span></code></pre></div><h5 id=response-status-7>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h5 id=response-body-7>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>1</span>
</span></span></code></pre></div><h4 id=1033-修改用户组>10.3.3 修改用户组</h4><h5 id=params-7>Params</h5><ul><li>id: 需要修改的用户组 Id</li></ul><h5 id=method--url-8>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/auth/groups/-69:grant
</span></span></code></pre></div><h5 id=request-body-3>Request Body</h5><p>修改 group_description</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-8>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-8>Response Body</h5><p>返回结果是包含修改过的内容在内的整个用户组对象</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 09:50:58.458&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 09:57:58.155&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1034-查询用户组列表>10.3.4 查询用户组列表</h4><h5 id=params-8>Params</h5><ul><li>limit: 返回结果条数的上限</li></ul><h5 id=method--url-9>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/groups
</span></span></code></pre></div><h5 id=response-status-9>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-9>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;groups&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;group can do anything&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1035-查询某个用户组>10.3.5 查询某个用户组</h4><h5 id=params-9>Params</h5><ul><li>id: 需要查询的用户组 Id</li></ul><h5 id=method--url-10>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/groups/-69:all
</span></span></code></pre></div><h5 id=response-status-10>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-10>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:46:08.791&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;group can do anything&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=104-资源targetapi>10.4 资源(Target)API</h3><p>资源描述了图数据库中的数据,比如符合某一类条件的顶点,每一个资源包括 type、label、properties 三个要素,共有 18 种 type、
任意 label、任意 properties 的组合形成的资源,一个资源的内部条件是且关系,多个资源之间的条件是或关系。<br>资源接口包括:资源的创建、删除、修改和查询。</p><h4 id=1041-创建资源>10.4.1 创建资源</h4><h5 id=params-10>Params</h5><ul><li>target_name: 资源名称</li><li>target_graph: 资源图</li><li>target_url: 资源地址</li><li>target_resources: 资源定义 (列表)</li></ul><p>target_resources 可以包括多个 target_resource,以列表的形式存储。<br>每个 target_resource 包含:</p><ul><li>type:可选值 VERTEX, EDGE 等,可填 ALL,则表示可以是顶点或边;</li><li>label:可选值,⼀个顶点或边类型的名称,可填*,则表示任意类型;</li><li>properties:map 类型,可包含多个属性的键值对,必须匹配所有属性值,属性值⽀持填条件范围(age:
P.gte(18)),properties 如果为 null 表示任意属性均可,如果属性名和属性值均为‘*ʼ也表示任意属性均可。</li></ul><p>如精细资源:&ldquo;target_resources&rdquo;: [{&ldquo;type&rdquo;:&ldquo;VERTEX&rdquo;,&ldquo;label&rdquo;:&ldquo;person&rdquo;,&ldquo;properties&rdquo;:{&ldquo;city&rdquo;:&ldquo;Beijing&rdquo;,&ldquo;age&rdquo;:&ldquo;P.gte(20)&rdquo;}}]**<br>资源定义含义:类型是&rsquo;person&rsquo;的顶点,且城市属性是&rsquo;Beijing&rsquo;,年龄属性大于等于 20。</p><h5 id=request-body-4>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ALL&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=method--url-11>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/auth/targets
</span></span></code></pre></div><h5 id=response-status-11>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-11>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:32:01.192&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ALL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:32:01.192&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1042-删除资源>10.4.2 删除资源</h4><h5 id=params-11>Params</h5><ul><li>id: 需要删除的资源 Id</li></ul><h5 id=method--url-12>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/auth/targets/-77:gremlin
</span></span></code></pre></div><h5 id=response-status-12>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h5 id=response-body-12>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>1</span>
</span></span></code></pre></div><h4 id=1043-修改资源>10.4.3 修改资源</h4><h5 id=params-12>Params</h5><ul><li>id: 需要修改的资源 Id</li></ul><h5 id=method--url-13>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/auth/targets/-77:gremlin
</span></span></code></pre></div><h5 id=request-body-5>Request Body</h5><p>修改资源定义中的 type</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-13>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-13>Response Body</h5><p>返回结果是包含修改过的内容在内的整个用户组对象</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 09:34:13.848&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:gremlin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 09:37:12.780&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1044-查询资源列表>10.4.4 查询资源列表</h4><h5 id=params-13>Params</h5><ul><li>limit: 返回结果条数的上限</li></ul><h5 id=method--url-14>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/targets
</span></span></code></pre></div><h5 id=response-status-14>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-14>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;targets&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:32:01.192&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ALL&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:32:01.192&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:43:24.841&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GRANT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:43:24.841&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1045-查询某个资源>10.4.5 查询某个资源</h4><h5 id=params-14>Params</h5><ul><li>id: 需要查询的资源 Id</li></ul><h5 id=method--url-15>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/targets/-77:grant
</span></span></code></pre></div><h5 id=response-status-15>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-15>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_name&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_url&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;127.0.0.1:8080&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_graph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:43:24.841&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_resources&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;type&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GRANT&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;label&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;*&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;properties&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#204a87;font-weight:700>null</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>],</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:43:24.841&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=105-关联角色belongapi>10.5 关联角色(Belong)API</h3><p>关联用户和用户组的关系,一个用户可以关联一个或者多个用户组。用户组拥有相关资源的权限,不同用户组的资源权限可以理解为不同的角色。即给用户关联角色。<br>关联角色接口包括:用户关联角色的创建、删除、修改和查询。</p><h4 id=1051-创建用户的关联角色>10.5.1 创建用户的关联角色</h4><h5 id=params-15>Params</h5><ul><li>user: 用户 Id</li><li>group: 用户组 Id</li><li>belong_description: 描述</li></ul><h5 id=request-body-6>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=method--url-16>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/auth/belongs
</span></span></code></pre></div><h5 id=response-status-16>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-16>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-63:boss&gt;-82&gt;&gt;S-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1052-删除关联角色>10.5.2 删除关联角色</h4><h5 id=params-16>Params</h5><ul><li>id: 需要删除的关联角色 Id</li></ul><h5 id=method--url-17>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/auth/belongs/S-63:boss&gt;-82&gt;&gt;S-69:grant
</span></span></code></pre></div><h5 id=response-status-17>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h5 id=response-body-17>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>1</span>
</span></span></code></pre></div><h4 id=1053-修改关联角色>10.5.3 修改关联角色</h4><p>关联角色只能修改描述,不能修改 user 和 group 属性,如果需要修改关联角色,需要删除原来关联关系,新增关联角色。</p><h5 id=params-17>Params</h5><ul><li>id: 需要修改的关联角色 Id</li></ul><h5 id=method--url-18>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/auth/belongs/S-63:boss&gt;-82&gt;&gt;S-69:grant
</span></span></code></pre></div><h5 id=request-body-7>Request Body</h5><p>修改 belong_description</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;update test&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-18>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-18>Response Body</h5><p>返回结果是包含修改过的内容在内的整个用户组对象</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;update test&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:40:21.720&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:42:47.265&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-63:boss&gt;-82&gt;&gt;S-69:grant&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:grant&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1054-查询关联角色列表>10.5.4 查询关联角色列表</h4><h5 id=params-18>Params</h5><ul><li>limit: 返回结果条数的上限</li></ul><h5 id=method--url-19>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/belongs
</span></span></code></pre></div><h5 id=response-status-19>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-19>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belongs&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-63:boss&gt;-82&gt;&gt;S-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1055-查看某个关联角色>10.5.5 查看某个关联角色</h4><h5 id=params-19>Params</h5><ul><li>id: 需要查询的关联角色 Id</li></ul><h5 id=method--url-20>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/belongs/S-63:boss&gt;-82&gt;&gt;S-69:all
</span></span></code></pre></div><h5 id=response-status-20>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-20>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;belong_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 16:19:35.422&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-63:boss&gt;-82&gt;&gt;S-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;user&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-63:boss&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=106-赋权accessapi>10.6 赋权(Access)API</h3><p>给用户组赋予资源的权限,主要包含:读操作 (READ)、写操作 (WRITE)、删除操作 (DELETE)、执行操作 (EXECUTE) 等。<br>赋权接口包括:赋权的创建、删除、修改和查询。</p><h4 id=1061-创建赋权-用户组赋予资源的权限>10.6.1 创建赋权 (用户组赋予资源的权限)</h4><h5 id=params-20>Params</h5><ul><li>group: 用户组 Id</li><li>target: 资源 Id</li><li>access_permission: 权限许可</li><li>access_description: 赋权描述</li></ul><p>access_permission:</p><ul><li>READ:读操作,所有的查询,包括查询 Schema、查顶点/边,查询顶点和边的数量 VERTEX_AGGR/EDGE_AGGR,也包括读图的状态 STATUS、变量 VAR、任务 TASK 等;</li><li>WRITE:写操作,所有的创建、更新操作,包括给 Schema 增加 property key,给顶点增加或更新属性等;</li><li>DELETE:删除操作,包括删除元数据、删除顶点/边;</li><li>EXECUTE:执⾏操作,包括执⾏ Gremlin 语句、执⾏ Task、执⾏ metadata 函数;</li></ul><h5 id=request-body-8>Request Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_permission&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;READ&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=method--url-21>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>POST http://localhost:8080/graphs/hugegraph/auth/accesses
</span></span></code></pre></div><h5 id=response-status-21>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>201</span>
</span></span></code></pre></div><h5 id=response-body-21>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_permission&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;READ&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-69:all&gt;-88&gt;11&gt;S-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1062-删除赋权>10.6.2 删除赋权</h4><h5 id=params-21>Params</h5><ul><li>id: 需要删除的赋权 Id</li></ul><h5 id=method--url-22>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>DELETE http://localhost:8080/graphs/hugegraph/auth/accesses/S-69:all&gt;-88&gt;12&gt;S-77:all
</span></span></code></pre></div><h5 id=response-status-22>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>204</span>
</span></span></code></pre></div><h5 id=response-body-22>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>1</span>
</span></span></code></pre></div><h4 id=1063-修改赋权>10.6.3 修改赋权</h4><p>赋权只能修改描述,不能修改用户组、资源和权限许可,如果需要修改赋权的关系,可以删除原来的赋权关系,新增赋权。</p><h5 id=params-22>Params</h5><ul><li>id: 需要修改的赋权 Id</li></ul><h5 id=method--url-23>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/hugegraph/auth/accesses/S-69:all&gt;-88&gt;12&gt;S-77:all
</span></span></code></pre></div><h5 id=request-body-9>Request Body</h5><p>修改 access_description</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;test&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=response-status-23>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-23>Response Body</h5><p>返回结果是包含修改过的内容在内的整个用户组对象</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_description&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;test&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_permission&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;WRITE&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:12:03.074&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-69:all&gt;-88&gt;12&gt;S-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-12 10:16:18.637&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1064-查询赋权列表>10.6.4 查询赋权列表</h4><h5 id=params-23>Params</h5><ul><li>limit: 返回结果条数的上限</li></ul><h5 id=method--url-24>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/accesses
</span></span></code></pre></div><h5 id=response-status-24>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-24>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;accesses&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>[</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_permission&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;READ&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-69:all&gt;-88&gt;11&gt;S-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=1065-查询某个赋权>10.6.5 查询某个赋权</h4><h5 id=params-24>Params</h5><ul><li>id: 需要查询的赋权 Id</li></ul><h5 id=method--url-25>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/hugegraph/auth/accesses/S-69:all&gt;-88&gt;11&gt;S-77:all
</span></span></code></pre></div><h5 id=response-status-25>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-25>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_permission&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;READ&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;S-69:all&gt;-88&gt;11&gt;S-77:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_update&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;2020-11-11 15:54:54.008&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;access_creator&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;admin&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;group&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-69:all&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;target&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;-77:all&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-db6682f721f1c345d19274e452d1d3d3>5.1.17 - Metrics API</h1><p>HugeGraph 提供了获取监控信息的 Metrics 接口,比如各个 Gremlin 执行时间的统计、缓存的占用大小等。Metrics
接口包括如下几类:基础指标、统计指标、系统指标、后端存储指标。</p><h2 id=1-基础指标>1. 基础指标</h2><h3 id=11-获取所有基础指标>1.1 获取所有基础指标</h3><h5 id=params>Params</h5><ul><li>type:如果传值为<code>json</code>,则以 json 格式返回,否则以 Promethaus 格式返回。</li></ul><h5 id=111-method--url>1.1.1 Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>http://localhost:8080/metrics/?type=json
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gauges&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1000000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.instances&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>17</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>17</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.server.RestServer.max-write-threads&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.task.TaskManager.pending-tasks&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.task.TaskManager.workers&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.average-load-penalty&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>922769200</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.estimated-size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.eviction-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.eviction-weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.hit-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.hit-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-failure-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-failure-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-success-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.long-run-compilation-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.miss-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.miss-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.request-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.total-load-time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1845538400</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.sessions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;counters&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;histograms&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>12.6852124529148</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6.992918475157571</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>8.942674506664073</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>16.665399873223066</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;meters&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.commit-succeed&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.expected-error&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.illegal-arg&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.unknown-error&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.errors&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;timers&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.delete&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.get&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.list&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#a40000>...</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=112-method--url>1.1.2 Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>http://localhost:8080/metrics/
</span></span></code></pre></div><h5 id=response-status-1>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-1>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span># HELP hugegraph_info
</span></span><span style=display:flex><span># TYPE hugegraph_info untyped
</span></span><span style=display:flex><span>hugegraph_info{version=&#34;0.69&#34;,
</span></span><span style=display:flex><span>} 1.0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_capacity
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_capacity gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_capacity 1000000
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_expire
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_expire gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_expire 600000
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_hits
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_hits gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_hits 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_miss
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_miss gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_miss 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_size
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_size gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_edge_hugegraph_size 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_instances
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_instances gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_instances 7
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_capacity
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_capacity gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_capacity 10000
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_expire
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_expire gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_expire 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_hits
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_hits gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_hits 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_miss
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_miss gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_miss 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_size
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_size gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_id_hugegraph_size 17
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_capacity
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_capacity gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_capacity 10000
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_expire
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_expire gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_expire 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_hits
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_hits gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_hits 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_miss
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_miss gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_miss 0
</span></span><span style=display:flex><span># HELP org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_size
</span></span><span style=display:flex><span># TYPE org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_size gauge
</span></span><span style=display:flex><span>org_apache_hugegraph_backend_cache_Cache_schema_name_hugegraph_size 17
</span></span><span style=display:flex><span>...
</span></span></code></pre></div><h3 id=12-获取-gauges-指标>1.2 获取 Gauges 指标</h3><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>http://localhost:8080/metrics/gauges
</span></span></code></pre></div><h5 id=response-status-2>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-2>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1000000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.edge-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.instances&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-id-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>17</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.schema-name-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>17</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.token-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10240</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.users_pwd-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10000000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.expire&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>600000</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.hits&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.miss&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.backend.cache.Cache.vertex-hugegraph.size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.server.RestServer.max-write-threads&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.task.TaskManager.pending-tasks&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.task.TaskManager.workers&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>4</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.average-load-penalty&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>9.227692E8</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.estimated-size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.eviction-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.eviction-weight&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.hit-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.hit-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-failure-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-failure-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.load-success-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.long-run-compilation-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.miss-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.miss-rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.request-count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.gremlin-groovy.sessionless.class-cache.total-load-time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1845538400</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.sessions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;value&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=13-获取-counters-指标>1.3 获取 Counters 指标</h3><h5 id=method--url-1>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/counters
</span></span></code></pre></div><h5 id=response-status-3>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-3>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics//GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics//GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/statistics/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/statistics/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/timers/GET/SUCCESS_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/timers/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/FAILED_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/TOTAL_COUNTER&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=14-获取-histograms-指标>1.4 获取 histograms 指标</h3><h5 id=method--url-2>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/gauges
</span></span></code></pre></div><h5 id=response-status-4>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-4>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics//GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>12.6852124529148</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6.992918475157571</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>6.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/statistics/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.4551211076264199</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.49798181193626</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>8.942674506664073</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>16.665399873223066</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/timers/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET/RESPONSE_TIME_HISTOGRAM&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=15-获取-meters-指标>1.5 获取 meters 指标</h3><h5 id=method--url-3>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/meters
</span></span></code></pre></div><h5 id=response-status-5>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-5>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.commit-succeed&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.expected-error&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.illegal-arg&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.API.unknown-error&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.tinkerpop.gremlin.server.GremlinServer.errors&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;events/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h3 id=16-获取-timers-指标>1.6 获取 timers 指标</h3><h5 id=method--url-4>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/timers
</span></span></code></pre></div><h5 id=response-status-6>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-6>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.create&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;org.apache.hugegraph.api.auth.AccessAPI.delete&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;min&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;stddev&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p50&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p75&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p95&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p98&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p99&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;p999&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;duration_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;milliseconds&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mean_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m15_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m5_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;m1_rate&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;rate_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;calls/second&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#a40000>...</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h2 id=2统计指标>2.统计指标</h2><h5 id=params-1>Params</h5><ul><li>type:如果传值为 json,则以 json 格式返回,否则以 Promethaus 格式返回。</li></ul><h5 id=21-method--url>2.1 Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/statistics
</span></span></code></pre></div><h5 id=response-status-7>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span># HELP hugegraph_info
</span></span><span style=display:flex><span># TYPE hugegraph_info untyped
</span></span><span style=display:flex><span>hugegraph_info{version=&#34;0.69&#34;,
</span></span><span style=display:flex><span>} 1.0
</span></span><span style=display:flex><span># HELP metrics_POST
</span></span><span style=display:flex><span># TYPE metrics_POST gauge
</span></span><span style=display:flex><span>metrics_POST{name=FAILED_REQUEST,} 1
</span></span><span style=display:flex><span>metrics_POST{name=MEAN_RESPONSE_TIME,} 21.0
</span></span><span style=display:flex><span>metrics_POST{
</span></span><span style=display:flex><span>name=MAX_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 21
</span></span><span style=display:flex><span>metrics_POST{name=SUCCESS_REQUEST,
</span></span><span style=display:flex><span>} 0
</span></span><span style=display:flex><span>metrics_POST{
</span></span><span style=display:flex><span>name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span># HELP metrics_backend_GET
</span></span><span style=display:flex><span># TYPE metrics_backend_GET gauge
</span></span><span style=display:flex><span>metrics_backend_GET{name=FAILED_REQUEST,
</span></span><span style=display:flex><span>} 0
</span></span><span style=display:flex><span>metrics_backend_GET{
</span></span><span style=display:flex><span>name=MEAN_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 12.6852124529148
</span></span><span style=display:flex><span>metrics_backend_GET{
</span></span><span style=display:flex><span>name=MAX_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 20
</span></span><span style=display:flex><span>metrics_backend_GET{
</span></span><span style=display:flex><span>name=SUCCESS_REQUEST,
</span></span><span style=display:flex><span>} 2
</span></span><span style=display:flex><span>metrics_backend_GET{name=TOTAL_REQUEST,} 2
</span></span><span style=display:flex><span># HELP system_GET
</span></span><span style=display:flex><span># TYPE system_GET gauge
</span></span><span style=display:flex><span>system_GET{name=FAILED_REQUEST,} 1
</span></span><span style=display:flex><span>system_GET{name=MEAN_RESPONSE_TIME,} 2.0
</span></span><span style=display:flex><span>system_GET{name=MAX_RESPONSE_TIME,} 2
</span></span><span style=display:flex><span>system_GET{
</span></span><span style=display:flex><span>name=SUCCESS_REQUEST,
</span></span><span style=display:flex><span>} 0
</span></span><span style=display:flex><span>system_GET{name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span># HELP metrics_gauges_GET
</span></span><span style=display:flex><span># TYPE metrics_gauges_GET gauge
</span></span><span style=display:flex><span>metrics_gauges_GET{name=FAILED_REQUEST,} 0
</span></span><span style=display:flex><span>metrics_gauges_GET{name=MEAN_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 7.0
</span></span><span style=display:flex><span>metrics_gauges_GET{
</span></span><span style=display:flex><span>name=MAX_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 7
</span></span><span style=display:flex><span>metrics_gauges_GET{
</span></span><span style=display:flex><span>name=SUCCESS_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span>metrics_gauges_GET{
</span></span><span style=display:flex><span>name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span># HELP favicon.ico_GET
</span></span><span style=display:flex><span># TYPE favicon.ico_GET gauge
</span></span><span style=display:flex><span>favicon.ico_GET{name=FAILED_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span>favicon.ico_GET{
</span></span><span style=display:flex><span>name=MEAN_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 1.0
</span></span><span style=display:flex><span>favicon.ico_GET{name=MAX_RESPONSE_TIME,} 1
</span></span><span style=display:flex><span>favicon.ico_GET{name=SUCCESS_REQUEST,} 0
</span></span><span style=display:flex><span>favicon.ico_GET{
</span></span><span style=display:flex><span>name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 1
</span></span><span style=display:flex><span># HELP metrics__GET
</span></span><span style=display:flex><span># TYPE metrics__GET gauge
</span></span><span style=display:flex><span>metrics__GET{name=FAILED_REQUEST,} 0
</span></span><span style=display:flex><span>metrics__GET{name=MEAN_RESPONSE_TIME,} 10.0
</span></span><span style=display:flex><span>metrics__GET{name=MAX_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 10
</span></span><span style=display:flex><span>metrics__GET{
</span></span><span style=display:flex><span>name=SUCCESS_REQUEST,
</span></span><span style=display:flex><span>} 2
</span></span><span style=display:flex><span>metrics__GET{
</span></span><span style=display:flex><span>name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 2
</span></span><span style=display:flex><span># HELP metrics_system_GET
</span></span><span style=display:flex><span># TYPE metrics_system_GET gauge
</span></span><span style=display:flex><span>metrics_system_GET{name=FAILED_REQUEST,} 0
</span></span><span style=display:flex><span>metrics_system_GET{name=MEAN_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 8.942674506664073
</span></span><span style=display:flex><span>metrics_system_GET{
</span></span><span style=display:flex><span>name=MAX_RESPONSE_TIME,
</span></span><span style=display:flex><span>} 40
</span></span><span style=display:flex><span>metrics_system_GET{name=SUCCESS_REQUEST,} 2
</span></span><span style=display:flex><span>metrics_system_GET{name=TOTAL_REQUEST,
</span></span><span style=display:flex><span>} 2
</span></span></code></pre></div><h5 id=response-body-7>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=22-method--url>2.2 Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/statistics?type=json
</span></span></code></pre></div><h5 id=response-status-8>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-8>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/POST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>21</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/backend/GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>12.6852124529148</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;system/GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/gauges/GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>7</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;favicon.ico/GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics//GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>10</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;metrics/system/GET&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;FAILED_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MEAN_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>8.942674506664073</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;MAX_RESPONSE_TIME&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>40</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;SUCCESS_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;TOTAL_REQUEST&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h2 id=3系统指标>3.系统指标</h2><p>系统指标主要返回机器运行指标,如内存、线程等信息。</p><h5 id=method--url-5>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/system
</span></span></code></pre></div><h5 id=response-status-9>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-9>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;basic&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1010</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_total&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>911</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_used&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>239</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_free&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>671</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;MB&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;processors&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>20</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;uptime&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>137503</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;systemload_average&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>-1.0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;heap&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;committed&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>911</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;init&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>254</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;used&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>239</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3596</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nonheap&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;committed&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>98</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;init&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;used&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>95</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;max&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;thread&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;peak&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>82</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;daemon&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>34</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;total_started&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>108</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>82</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;class_loading&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>11495</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;loaded&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>11495</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;unloaded&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>},</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;garbage_collector&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ps_scavenge_count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>16</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ps_scavenge_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>155</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ps_marksweep_count&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>3</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;ps_marksweep_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>494</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;time_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;ms&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><h2 id=4后端指标>4.后端指标</h2><p>hugeGraph 支持多种后端存储,后端指标包括内存、磁盘等信息。</p><h5 id=method--url-6>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/metrics/backend
</span></span></code></pre></div><h5 id=response-status-10>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body-10>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;hugegraph&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;backend&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;rocksdb&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;nodes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cluster_id&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;local&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;servers&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;local&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;MB&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;disk_unit&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;GB&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_used&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.1</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_used_readable&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;103.53 KB&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;disk_usage&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.03</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;disk_usage_readable&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;29.03 KB&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;block_cache_usage&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.00359344482421875</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;block_cache_pinned_usage&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.00359344482421875</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;block_cache_capacity&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>304.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;estimate_table_readers_mem&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.019697189331054688</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;size_all_mem_tables&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.07421875</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;cur_size_all_mem_tables&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.07421875</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;estimate_live_data_size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5.536526441574097E-5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;total_sst_files_size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5.536526441574097E-5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;live_sst_files_size&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>5.536526441574097E-5</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;estimate_pending_compaction_bytes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0.0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;estimate_num_keys&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_entries_active_mem_table&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_entries_imm_mem_tables&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_deletes_active_mem_table&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_deletes_imm_mem_tables&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_running_flushes&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mem_table_flush_pending&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_running_compactions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;compaction_pending&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_immutable_mem_table&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_snapshots&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;oldest_snapshot_time&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>0</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;num_live_versions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>38</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;current_super_version_number&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#0000cf;font-weight:700>38</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-8e126d4f2f7317a1268d7edb65cd4fcc>5.1.18 - Other API</h1><h3 id=111-other>11.1 Other</h3><h4 id=1111-查看hugegraph的版本信息>11.1.1 查看HugeGraph的版本信息</h4><h5 id=method--url>Method & Url</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/versions
</span></span></code></pre></div><h5 id=response-status>Response Status</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h5 id=response-body>Response Body</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;versions&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;version&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;v1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;core&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0.4.5.1&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;gremlin&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;3.2.5&#34;</span><span style=color:#000;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;api&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;0.13.2.0&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#000;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-3457a7585a93814fdbb1a44b68edc0d3>5.2 - HugeGraph Java Client</h1><p>本文的代码都是<code>java</code>语言写的,但其风格与<code>gremlin(groovy)</code>是非常类似的。用户只需要把代码中的变量声明替换成<code>def</code>或直接去掉,
就能将<code>java</code>代码转变为<code>groovy</code>;另外就是每一行语句最后可以不加分号,<code>groovy</code>认为一行就是一条语句。
用户在<code>HugeGraph-Studio</code>中编写的<code>gremlin(groovy)</code>可以参考本文的<code>java</code>代码,下面会举出几个例子。</p><h3 id=1-hugegraph-client>1 HugeGraph-Client</h3><p>HugeGraph-Client 是操作 graph 的总入口,用户必须先创建出 HugeGraph-Client 对象,与 HugeGraph-Server 建立连接(伪连接)后,才能获取到 schema、graph 以及 gremlin 的操作入口对象。</p><p>目前 HugeGraph-Client 只允许连接服务端已存在的图,无法自定义图进行创建。其创建方法如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// HugeGraphServer地址:&#34;http://localhost:8080&#34;
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 图的名称:&#34;hugegraph&#34;
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>HugeClient</span> <span style=color:#000>hugeClient</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>HugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>builder</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;http://localhost:8080&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hugegraph&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>configTimeout</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>20</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#8f5902;font-style:italic>// 默认 20s 超时
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>configUser</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;**&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;**&#34;</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#8f5902;font-style:italic>// 默认未开启用户权限
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>build</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><p>上述创建 HugeClient 的过程如果失败会抛出异常,用户需要try-catch。如果成功则继续获取 schema、graph 以及 gremlin 的 manager。</p><p><code>HugeGraph - Hubble / Studio</code>中通过<code>gremlin</code>来操作时,不需要使用<code>HugeClient</code>,可以忽略。</p><h3 id=2-元数据>2 元数据</h3><h4 id=21-schemamanager>2.1 SchemaManager</h4><p>SchemaManager 用于管理 HugeGraph 中的四种元数据,分别是PropertyKey(属性类型)、VertexLabel(顶点类型)、EdgeLabel(边类型)和 IndexLabel(索引标签)。在定义元数据信息之前必须先创建 SchemaManager 对象。</p><p>用户可使用如下方法获得SchemaManager对象:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>SchemaManager</span> <span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugeClient</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><p><code>HugeGraph-Studio</code>中通过<code>gremlin</code>创建<code>schema</code>对象:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><p>下面分别对三种元数据的定义过程进行介绍。</p><h4 id=22-propertykey>2.2 PropertyKey</h4><h5 id=221-接口及参数介绍>2.2.1 接口及参数介绍</h5><p>PropertyKey 用来规范顶点和边的属性的约束,暂不支持定义属性的属性。</p><p>PropertyKey 允许定义的约束信息包括:name、datatype、cardinality、userdata,下面逐一介绍。</p><ul><li>name: 属性的名字,用来区分不同的 PropertyKey,不允许有同名的属性;</li></ul><table><thead><tr><th>interface</th><th>param</th><th>must set</th></tr></thead><tbody><tr><td>propertyKey(String name)</td><td>name</td><td>y</td></tr></tbody></table><ul><li>datatype:属性值类型,必须从下表中选择符合具体业务场景的一项显式设置;</li></ul><table><thead><tr><th>interface</th><th>Java Class</th></tr></thead><tbody><tr><td>asText()</td><td>String</td></tr><tr><td>asInt()</td><td>Integer</td></tr><tr><td>asDate()</td><td>Date</td></tr><tr><td>asUuid()</td><td>UUID</td></tr><tr><td>asBoolean()</td><td>Boolean</td></tr><tr><td>asByte()</td><td>Byte</td></tr><tr><td>asBlob()</td><td>Byte[]</td></tr><tr><td>asDouble()</td><td>Double</td></tr><tr><td>asFloat()</td><td>Float</td></tr><tr><td>asLong()</td><td>Long</td></tr></tbody></table><ul><li>cardinality:属性值是单值还是多值,多值的情况下又分为允许有重复值和不允许有重复值,该项默认为 single,如有必要可从下表中选择一项设置;</li></ul><table><thead><tr><th>interface</th><th>cardinality</th><th>description</th></tr></thead><tbody><tr><td>valueSingle()</td><td>single</td><td>single value</td></tr><tr><td>valueList()</td><td>list</td><td>multi-values that allow duplicate value</td></tr><tr><td>valueSet()</td><td>set</td><td>multi-values that not allow duplicate value</td></tr></tbody></table><ul><li>userdata:用户可以自己添加一些约束或额外信息,然后自行检查传入的属性是否满足约束,或者必要的时候提取出额外信息</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>userdata(String key, Object value)</td><td>The same key, the latter will cover the former</td></tr></tbody></table><h5 id=222-创建-propertykey>2.2.2 创建 PropertyKey</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>valueSet</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><p><code>HugeGraph-Studio</code>中通过<code>gremlin</code>创建上述<code>PropertyKey</code>对象的语法完全一致,如果用户没有定义出<code>schema</code>变量,应该这样写:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>valueSet</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><p>以下的示例中,<code>gremlin</code><code>java</code>的语法完全一致,不再赘述。</p><ul><li>ifNotExist():为 create 添加判断机制,若当前 PropertyKey 已经存在则不再创建,否则创建该属性。若不添加判断,在 properkey 已存在的情况下会抛出异常信息,下同,不再赘述。</li></ul><h5 id=223-删除-propertykey>2.2.3 删除 PropertyKey</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>remove</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h5 id=224-查询-propertykey>2.2.4 查询 PropertyKey</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取PropertyKey对象
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取PropertyKey属性
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>cardinality</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>dataType</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>name</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>userdata</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=23-vertexlabel>2.3 VertexLabel</h4><h5 id=231-接口及参数介绍>2.3.1 接口及参数介绍</h5><p>VertexLabel 用来定义顶点类型,描述顶点的约束信息:</p><p>VertexLabel 允许定义的约束信息包括:name、idStrategy、properties、primaryKeys和 nullableKeys,下面逐一介绍。</p><ul><li>name: 属性的名字,用来区分不同的 VertexLabel,不允许有同名的属性;</li></ul><table><thead><tr><th>interface</th><th>param</th><th>must set</th></tr></thead><tbody><tr><td>vertexLabel(String name)</td><td>name</td><td>y</td></tr></tbody></table><ul><li>idStrategy: 每一个 VertexLabel 都可以选择自己的 Id 策略,目前有三种策略供选择,即 Automatic(自动生成)、Customize(用户传入)和 PrimaryKey(主属性键)。其中 Automatic 使用 Snowflake 算法生成 Id,Customize 需要用户自行传入字符串或数字类型的 Id,PrimaryKey 则允许用户从 VertexLabel 的属性中选择若干主属性作为区分的依据,HugeGraph 内部会根据主属性的值拼接生成 Id。idStrategy 默认使用 Automatic的,但如果用户没有显式设置 idStrategy 又调用了 primaryKeys(&mldr;) 方法设置了主属性,则 idStrategy 将自动使用 PrimaryKey;</li></ul><table><thead><tr><th>interface</th><th>idStrategy</th><th>description</th></tr></thead><tbody><tr><td>useAutomaticId</td><td>AUTOMATIC</td><td>generate id automatically by Snowflake algorithm</td></tr><tr><td>useCustomizeStringId</td><td>CUSTOMIZE_STRING</td><td>passed id by user, must be string type</td></tr><tr><td>useCustomizeNumberId</td><td>CUSTOMIZE_NUMBER</td><td>passed id by user, must be number type</td></tr><tr><td>usePrimaryKeyId</td><td>PRIMARY_KEY</td><td>choose some important prop as primary key to splice id</td></tr></tbody></table><ul><li>properties: 定义顶点的属性,传入的参数是 PropertyKey 的 name</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>properties(String&mldr; properties)</td><td>allow to pass multi props</td></tr></tbody></table><ul><li>primaryKeys: 当用户选择了 PrimaryKey 的 Id 策略时,需要从 VertexLabel 的属性中选择若干主属性作为区分的依据;</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>primaryKeys(String&mldr; keys)</td><td>allow to choose multi prop as primaryKeys</td></tr></tbody></table><p>需要注意的是,Id 策略的选择与 primaryKeys 的设置有一些相互约束,不能随意调用,约束关系见下表:</p><table><thead><tr><th></th><th>useAutomaticId</th><th>useCustomizeStringId</th><th>useCustomizeNumberId</th><th>usePrimaryKeyId</th></tr></thead><tbody><tr><td>unset primaryKeys</td><td>AUTOMATIC</td><td>CUSTOMIZE_STRING</td><td>CUSTOMIZE_NUMBER</td><td>ERROR</td></tr><tr><td>set primaryKeys</td><td>ERROR</td><td>ERROR</td><td>ERROR</td><td>PRIMARY_KEY</td></tr></tbody></table><ul><li>nullableKeys: 对于通过 properties(&mldr;) 方法设置过的属性,默认全都是不可为空的,也就是在创建顶点时该属性必须赋值,这样可能对用户数据提出了太过严格的完整性要求。为避免这样的强约束,用户可以通过
本方法设置若干属性为可空的,这样添加顶点时该属性可以不赋值。</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>nullableKeys(String&mldr; properties)</td><td>allow to pass multi props</td></tr></tbody></table><p>注意:primaryKeys 和 nullableKeys 不能有交集,因为一个属性不能既作为主属性,又是可空的。</p><ul><li>enableLabelIndex:用户可以指定是否需要为label创建索引。不创建则无法全局搜索指定label的顶点和边,创建则可以全局搜索,做类似于<code>g.V().hasLabel('person'), g.E().has('label', 'person')</code>这样的查询,
但是插入数据时性能上会更加慢,并且需要占用更多的存储空间。此项默认为 true。</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>enableLabelIndex(boolean enable)</td><td>Whether to create a label index</td></tr></tbody></table><ul><li>userdata:用户可以自己添加一些约束或额外信息,然后自行检查传入的属性是否满足约束,或者必要的时候提取出额外信息</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>userdata(String key, Object value)</td><td>The same key, the latter will cover the former</td></tr></tbody></table><h5 id=232-创建-vertexlabel>2.3.2 创建 VertexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 使用 Automatic 的 Id 策略
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>useAutomaticId</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 使用 Customize_String 的 Id 策略
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>useCustomizeStringId</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 使用 Customize_Number 的 Id 策略
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>useCustomizeNumberId</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 使用 PrimaryKey 的 Id 策略
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>usePrimaryKeyId</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=233-追加-vertexlabel>2.3.3 追加 VertexLabel</h5><p>VertexLabel 是可以追加约束的,不过仅限 properties 和 nullableKeys,而且追加的属性也必须添加到 nullableKeys 集合中。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>append</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=234-删除-vertexlabel>2.3.4 删除 VertexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>remove</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=235-查询-vertexlabel>2.3.5 查询 VertexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取VertexLabel对象
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取property key属性
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>idStrategy</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>name</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>userdata</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=24-edgelabel>2.4 EdgeLabel</h4><h5 id=241-接口及参数介绍>2.4.1 接口及参数介绍</h5><p>EdgeLabel 用来定义边类型,描述边的约束信息。</p><p>EdgeLabel 允许定义的约束信息包括:name、sourceLabel、targetLabel、frequency、properties、sortKeys 和 nullableKeys,下面逐一介绍。</p><ul><li>name: 属性的名字,用来区分不同的 EdgeLabel,不允许有同名的属性;</li></ul><table><thead><tr><th>interface</th><th>param</th><th>must set</th></tr></thead><tbody><tr><td>edgeLabel(String name)</td><td>name</td><td>y</td></tr></tbody></table><ul><li><p>sourceLabel: 边连接的源顶点类型名,只允许设置一个;</p></li><li><p>targetLabel: 边连接的目标顶点类型名,只允许设置一个;</p></li></ul><table><thead><tr><th>interface</th><th>param</th><th>must set</th></tr></thead><tbody><tr><td>sourceLabel(String label)</td><td>label</td><td>y</td></tr><tr><td>targetLabel(String label)</td><td>label</td><td>y</td></tr></tbody></table><ul><li>frequency: 字面意思是频率,表示在两个具体的顶点间某个关系出现的次数,可以是单次(single)或多次(frequency),默认为single;</li></ul><table><thead><tr><th>interface</th><th>frequency</th><th>description</th></tr></thead><tbody><tr><td>singleTime()</td><td>single</td><td>a relationship can only occur once</td></tr><tr><td>multiTimes()</td><td>multiple</td><td>a relationship can occur many times</td></tr></tbody></table><ul><li>properties: 定义边的属性</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>properties(String&mldr; properties)</td><td>allow to pass multi props</td></tr></tbody></table><ul><li>sortKeys: 当 EdgeLabel 的 frequency 为 multiple 时,需要某些属性来区分这多次的关系,故引入了 sortKeys(排序键);</li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>sortKeys(String&mldr; keys)</td><td>allow to choose multi prop as sortKeys</td></tr></tbody></table><ul><li>nullableKeys: 与顶点中的 nullableKeys 概念一致,不再赘述</li></ul><p>注意:sortKeys 和 nullableKeys也不能有交集。</p><ul><li><p>enableLabelIndex:与顶点中的 enableLabelIndex 概念一致,不再赘述</p></li><li><p>userdata:用户可以自己添加一些约束或额外信息,然后自行检查传入的属性是否满足约束,或者必要的时候提取出额外信息</p></li></ul><table><thead><tr><th>interface</th><th>description</th></tr></thead><tbody><tr><td>userdata(String key, Object value)</td><td>The same key, the latter will cover the former</td></tr></tbody></table><h5 id=242-创建-edgelabel>2.4.2 创建 EdgeLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>multiTimes</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sortKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=243-追加-edgelabel>2.4.3 追加 EdgeLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>append</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=244-删除-edgelabel>2.4.4 删除 EdgeLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>remove</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=245-查询-edgelabel>2.4.5 查询 EdgeLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取EdgeLabel对象
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取property key属性
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>frequency</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sourceLabel</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>targetLabel</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>sortKeys</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>name</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>userdata</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=25-indexlabel>2.5 IndexLabel</h4><h5 id=251-接口及参数介绍>2.5.1 接口及参数介绍</h5><p>IndexLabel 用来定义索引类型,描述索引的约束信息,主要是为了方便查询。</p><p>IndexLabel 允许定义的约束信息包括:name、baseType、baseValue、indexFields、indexType,下面逐一介绍。</p><ul><li>name: 属性的名字,用来区分不同的 IndexLabel,不允许有同名的属性;</li></ul><table><thead><tr><th>interface</th><th>param</th><th>must set</th></tr></thead><tbody><tr><td>indexLabel(String name)</td><td>name</td><td>y</td></tr></tbody></table><ul><li><p>baseType: 表示要为 VertexLabel 还是 EdgeLabel 建立索引, 与下面的 baseValue 配合使用;</p></li><li><p>baseValue: 指定要建立索引的 VertexLabel 或 EdgeLabel 的名称;</p></li></ul><table><thead><tr><th>interface</th><th>param</th><th>description</th></tr></thead><tbody><tr><td>onV(String baseValue)</td><td>baseValue</td><td>build index for VertexLabel: &lsquo;baseValue&rsquo;</td></tr><tr><td>onE(String baseValue)</td><td>baseValue</td><td>build index for EdgeLabel: &lsquo;baseValue&rsquo;</td></tr></tbody></table><ul><li>indexFields: 要在哪些属性上建立索引,可以是为多列建立联合索引;</li></ul><table><thead><tr><th>interface</th><th>param</th><th>description</th></tr></thead><tbody><tr><td>by(String&mldr; fields)</td><td>files</td><td>allow to build index for multi fields for secondary index</td></tr></tbody></table><ul><li>indexType: 建立的索引类型,目前支持五种,即 Secondary、Range、Search、Shard 和 Unique。<ul><li>Secondary 支持精确匹配的二级索引,允许建立联合索引,联合索引支持索引前缀搜索<ul><li>单个属性,支持相等查询,比如:person顶点的city属性的二级索引,可以用<code>g.V().has("city", "北京") </code>查询"city属性值是北京"的全部顶点</li><li>联合索引,支持前缀查询和相等查询,比如:person顶点的city和street属性的联合索引,可以用<code>g.V().has ("city", "北京").has('street', '中关村街道') </code>查询"city属性值是北京且street属性值是中关村"的全部顶点,或者<code>g.V() .has("city", "北京")</code>查询"city属性值是北京"的全部顶点</li></ul><blockquote><p>secondary index的查询都是基于"是"或者"相等"的查询条件,不支持"部分匹配"</p></blockquote></li><li>Range 支持数值类型的范围查询<ul><li>必须是单个数字或者日期属性,比如:person顶点的age属性的范围索引,可以用<code>g.V().has("age", P.gt(18)) </code>查询"age属性值大于18"的顶点。除了<code>P.gt()</code>以外,还支持<code>P.gte()</code>, <code>P.lte()</code>, <code>P.lt()</code>,
<code>P.eq()</code>, <code>P.between()</code>, <code>P.inside()</code><code>P.outside()</code></li></ul></li><li>Search 支持全文检索的索引<ul><li>必须是单个文本属性,比如:person顶点的address属性的全文索引,可以用<code>g.V().has("address", Text .contains('大厦')</code>查询"address属性中包含大厦"的全部顶点</li></ul><blockquote><p>search index的查询是基于"是"或者"包含"的查询条件</p></blockquote></li><li>Shard 支持前缀匹配 + 数字范围查询的索引<ul><li>N个属性的分片索引,支持前缀相等情况下的范围查询,比如:person顶点的city和age属性的分片索引,可以用<code>g.V().has ("city", "北京").has("age", P.between(18, 30)) </code>查询"city属性是北京且年龄大于等于18小于30"的全部顶点</li><li>shard index N个属性全是文本属性时,等价于secondary index</li><li>shard index只有单个数字或者日期属性时,等价于range index</li></ul><blockquote><p>shard index可以有任意数字或者日期属性,但是查询时最多只能提供一个范围查找条件,且该范围查找条件的属性的前缀属性都是相等查询条件</p></blockquote></li><li>Unique 支持属性值唯一性约束,即可以限定属性的值不重复,允许联合索引,但不支持查询<ul><li>单个或者多个属性的唯一性索引,不可用来查询,只可对属性的值进行限定,当出现重复值时将报错</li></ul></li></ul></li></ul><table><thead><tr><th>interface</th><th>indexType</th><th>description</th></tr></thead><tbody><tr><td>secondary()</td><td>Secondary</td><td>support prefix search</td></tr><tr><td>range()</td><td>Range</td><td>support range(numeric or date type) search</td></tr><tr><td>search()</td><td>Search</td><td>support full text search</td></tr><tr><td>shard()</td><td>Shard</td><td>support prefix + range(numeric or date type) search</td></tr><tr><td>unique()</td><td>Unique</td><td>support unique props value, not support search</td></tr></tbody></table><h5 id=252-创建-indexlabel>2.5.2 创建 IndexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>range</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;createdByDate&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;date&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>secondary</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByLived&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onE</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lived&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>search</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByCityAndAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>shard</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personById&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>onV</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>unique</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span></code></pre></div><h5 id=253-删除-indexlabel>2.5.3 删除 IndexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>indexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>remove</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h5 id=254-查询-indexlabel>2.5.4 查询 IndexLabel</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取IndexLabel对象
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// 获取property key属性
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>baseType</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>baseValue</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>indexFields</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>indexType</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;personByAge&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>name</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h3 id=3-图数据>3 图数据</h3><h4 id=31-vertex>3.1 Vertex</h4><p>顶点是构成图的最基本元素,一个图中可以有非常多的顶点。下面给出一个添加顶点的例子:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>marko</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>29</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>lop</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;software&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lop&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lang&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;price&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>328</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><ul><li>添加顶点的关键是顶点属性,添加顶点函数的参数个数必须为偶数,且满足<code>key1 -> val1, key2 -> val2 ···</code>的顺序排列,键值对之间的顺序是自由的。</li><li>参数中必须包含一对特殊的键值对,就是<code>T.label -> "val"</code>,用来定义该顶点的类别,以便于程序从缓存或后端获取到该VertexLabel的schema定义,然后做后续的约束检查。例子中的label定义为person。</li><li>如果顶点类型的 Id 策略为 <code>AUTOMATIC</code>,则不允许用户传入 id 键值对。</li><li>如果顶点类型的 Id 策略为 <code>CUSTOMIZE_STRING</code>,则用户需要自己传入 String 类型 id 的值,键值对形如:<code>"T.id", "123456"</code></li><li>如果顶点类型的 Id 策略为 <code>CUSTOMIZE_NUMBER</code>,则用户需要自己传入 Number 类型 id 的值,键值对形如:<code>"T.id", 123456</code></li><li>如果顶点类型的 Id 策略为 <code>PRIMARY_KEY</code>,参数还必须全部包含该<code>primaryKeys</code>对应属性的名和值,如果不设置会抛出异常。比如之前<code>person</code><code>primaryKeys</code><code>name</code>,例子中就设置了<code>name</code>的值为<code>marko</code></li><li>对于非 nullableKeys 的属性,必须要赋值。</li><li>剩下的参数就是顶点其他属性的设置,但并非必须。</li><li>调用<code>addVertex</code>方法后,顶点会立刻被插入到后端存储系统中。</li></ul><h4 id=32-edge>3.2 Edge</h4><p>有了点,还需要边才能构成完整的图。下面给出一个添加边的例子:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>Edge</span> <span style=color:#000>knows1</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;knows&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><ul><li>由(源)顶点来调用添加边的函数,函数第一个参数为边的label,第二个参数是目标顶点,这两个参数的位置和顺序是固定的。后续的参数就是<code>key1 -> val1, key2 -> val2 ···</code>的顺序排列,设置边的属性,键值对顺序自由。</li><li>源顶点和目标顶点必须符合 EdgeLabel 中 source-label 和 target-label 的定义,不能随意添加。</li><li>对于非 nullableKeys 的属性,必须要赋值。</li></ul><p><strong>注意:当frequency为multiple时必须要设置sortKeys对应属性类型的值。</strong></p><h3 id=4-简单示例>4 简单示例</h3><p>简单示例见<a href=/docs/quickstart/hugegraph-client>HugeGraph-Client</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-1ebf9ecb86d8a6b8536fd581e696ce8c>5.3 - Gremlin-Console</h1><p>Gremlin-Console 是由 Tinkerpop 自己开发的一个交互式客户端,用户可以使用该客户端对 Graph 做各种操作,主要有两种使用模式:</p><ul><li>单机离线调用模式</li><li>Client/Server 请求模式</li></ul><p><strong>注:Gremlin-Console 只是便于用户快速上手体验,不建议在生产环境中使用。</strong></p><h3 id=1-单机离线调用模式>1 单机离线调用模式</h3><p>由于 lib 目录下已经包含了 HugeCore 的 jar 包,且 HugeGraph-Server 已经作为插件注册到 Gremlin-Console 中,用户可以直接写 Groovy 脚本调用 HugeGraph-Core 的代码,然后交由 Gremlin-Console 内的解析引擎执行,就能在<strong>不启动</strong> Server 的情况下操作图。</p><p>这里提供一个示例,首先修改 <code>hugegraph.properties</code> 配置使用 Memory 后端 (使用其他后端可能会出现一些初始化问题):</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=memory
</span></span><span style=display:flex><span>serializer=text
</span></span></code></pre></div><p>然后输入下述命令:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>&gt; ./bin/gremlin-console.sh -- -i scripts/example.groovy
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>\,</span>,,/
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>(</span>o o<span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>-----oOOo-<span style=color:#ce5c00;font-weight:700>(</span>3<span style=color:#ce5c00;font-weight:700>)</span>-oOOo-----
</span></span><span style=display:flex><span>plugin activated: HugeGraph
</span></span><span style=display:flex><span>plugin activated: tinkerpop.server
</span></span><span style=display:flex><span>plugin activated: tinkerpop.utilities
</span></span><span style=display:flex><span>plugin activated: tinkerpop.tinkergraph
</span></span><span style=display:flex><span>main dict load finished, <span style=color:#204a87>time</span> elapsed <span style=color:#0000cf;font-weight:700>644</span> ms
</span></span><span style=display:flex><span>model load finished, <span style=color:#204a87>time</span> elapsed <span style=color:#0000cf;font-weight:700>35</span> ms.
</span></span><span style=display:flex><span>&gt;&gt;&gt;&gt; query all vertices: <span style=color:#000>size</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span>&gt;&gt;&gt;&gt; query all edges: <span style=color:#000>size</span><span style=color:#ce5c00;font-weight:700>=</span><span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span>gremlin&gt;
</span></span></code></pre></div><blockquote><p>这里的 <code>--</code> 会被 getopts 解析为最后一个 option,这样后面的 options 就可以传入 Gremlin-Console 进行处理了。<code>-i</code> 代表 <code>Execute the specified script and leave the console open on completion</code>,更多的选项可以参考 Gremlin-Console 的<a href=https://github.com/apache/tinkerpop/blob/3.5.1/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy#L483>源代码</a></p></blockquote><p>其中 <a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/src/assembly/static/scripts/example.groovy><code>example.groovy</code></a> 是 scripts 目录下的一个示例脚本,该脚本插入了一些数据,并在最后查询图中顶点和边的数量。</p><p>此时还可以继续输入 Gremlin 语句对图进行操作:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>v</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>E</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S2:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>created</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S2:</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>created</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S1:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>knows</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S1:</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>knows</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S2:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>created</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>S1:</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>&gt;&gt;</span><span style=color:#f57900>S2:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>][</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>created</span><span style=color:#ce5c00;font-weight:700>-&gt;</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span>
</span></span></code></pre></div><p>更多的 Gremlin 语句请参考 <a href=http://tinkerpop.apache.org/docs/current/reference/>Tinkerpop 官网</a></p><h3 id=2-clientserver-请求模式>2 Client/Server 请求模式</h3><p>因为 Gremlin-Console 只能通过 WebSocket 连接 HugeGraph-Server,默认 HugeGraph-Server 是对外提供 HTTP 连接的,所以先修改 gremlin-server 的配置。</p><p><strong>注意:将连接方式修改为 WebSocket 后,HugeGraph-Client、HugeGraph-Loader、HugeGraph-Hubble 等配套工具都不能使用了。</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#8f5902;font-style:italic># vim conf/gremlin-server.yaml</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># ......</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># If you want to start gremlin-server for gremlin-console (web-socket),</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># please change `HttpChannelizer` to `WebSocketChannelizer` or comment this line.</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>channelizer</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#8f5902;font-style:italic># ......</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><p><code>channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer</code> 修改成 <code>channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer</code> 或直接注释,然后按照<a href=/docs/quickstart/hugegraph-server/>步骤</a>启动 HugeGraph-Server。</p><p>下面进入 Gremlin-Console:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>&gt; ./bin/gremlin-console.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>\,</span>,,/
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>(</span>o o<span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>-----oOOo-<span style=color:#ce5c00;font-weight:700>(</span>3<span style=color:#ce5c00;font-weight:700>)</span>-oOOo-----
</span></span><span style=display:flex><span>plugin activated: HugeGraph
</span></span><span style=display:flex><span>plugin activated: tinkerpop.server
</span></span><span style=display:flex><span>plugin activated: tinkerpop.utilities
</span></span><span style=display:flex><span>plugin activated: tinkerpop.tinkergraph
</span></span></code></pre></div><p>连接 Server,需在配置文件中指定连接参数,在 conf 目录下有一个默认的 <code>remote.yaml</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-yaml data-lang=yaml><span style=display:flex><span><span style=color:#8f5902;font-style:italic># cat conf/remote.yaml</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>hosts</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>localhost]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>port</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#0000cf;font-weight:700>8182</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span><span style=color:#204a87;font-weight:700>serializer</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>className</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000>org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>config</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span>{<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>serializeResultToString</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>false</span><span style=color:#000;font-weight:700>,</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#204a87;font-weight:700>ioRegistries</span><span style=color:#000;font-weight:700>:</span><span style=color:#f8f8f8;text-decoration:underline> </span><span style=color:#000;font-weight:700>[</span><span style=color:#000>org.apache.hugegraph.io.HugeGraphIoRegistry]</span><span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline> </span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span><span style=display:flex><span><span style=color:#f8f8f8;text-decoration:underline></span>}<span style=color:#f8f8f8;text-decoration:underline>
</span></span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>remote</span> <span style=color:#000>connect</span> <span style=color:#000>tinkerpop</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>server</span> <span style=color:#000>conf</span><span style=color:#4e9a06>/remote.yaml
</span></span></span><span style=display:flex><span><span style=color:#4e9a06>==&gt;Configured localhost/</span><span style=color:#0000cf;font-weight:700>127.0</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#0000cf;font-weight:700>0.1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#0000cf;font-weight:700>8182</span>
</span></span></code></pre></div><p>连接成功之后,如果在启动 HugeGraph-Server 的过程中导入了示例图,就可以在 Gremlin-Console 中直接进行查询:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#ce5c00;font-weight:700>:&gt;</span> <span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>traversal</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>software</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>lop</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>lang:</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>price:</span><span style=color:#0000cf;font-weight:700>328</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>person</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>josh</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>age:</span><span style=color:#0000cf;font-weight:700>32</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>city:</span><span style=color:#000>Beijing</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>person</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>marko</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>age:</span><span style=color:#0000cf;font-weight:700>29</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>city:</span><span style=color:#000>Beijing</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>person</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>peter</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>age:</span><span style=color:#0000cf;font-weight:700>35</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>city:</span><span style=color:#000>Shanghai</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>person</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>vadas</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>age:</span><span style=color:#0000cf;font-weight:700>27</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>city:</span><span style=color:#000>Hongkong</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;[</span><span style=color:#f57900>id:</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>label:</span><span style=color:#000>software</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>type:</span><span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>properties:</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#f57900>name:</span><span style=color:#000>ripple</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>lang:</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#f57900>price:</span><span style=color:#0000cf;font-weight:700>199</span><span style=color:#ce5c00;font-weight:700>]]</span>
</span></span></code></pre></div><blockquote><p>注意:在 Client/Server 模式下,所有和 Server 有关的操作都要加上 <code>:> </code>,如果不加,表示在 console 本地操作。</p></blockquote><p>还可以把多条语句放在一个字符串变量中,然后一次性发给 Server:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>script</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#4e9a06>&#34;&#34;&#34;
</span></span></span><span style=display:flex><span><span style=color:#4e9a06>......1&gt; graph = hugegraph;
</span></span></span><span style=display:flex><span><span style=color:#4e9a06>......2&gt; g = graph.traversal();
</span></span></span><span style=display:flex><span><span style=color:#4e9a06>......3&gt; g.V().toList().size();
</span></span></span><span style=display:flex><span><span style=color:#4e9a06>......4&gt; &#34;&#34;&#34;</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#000>g</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>traversal</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>toList</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>size</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#ce5c00;font-weight:700>:&gt;</span> <span style=color:#5c35cc;font-weight:700>@script</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>==&gt;</span><span style=color:#0000cf;font-weight:700>6</span>
</span></span><span style=display:flex><span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>&gt;</span>
</span></span></code></pre></div><p>更多关于 Gremlin-Console 的使用,请参考 <a href=http://tinkerpop.apache.org/docs/current/reference/>Tinkerpop 官网</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-d2c6535126cca927d2a9c893abde92a0>6 - GUIDES</h1></div><div class=td-content><h1 id=pg-dcb89d888ea6f4146ace522d76fe2776>6.1 - HugeGraph Architecture Overview</h1><h3 id=1-概述>1 概述</h3><p>作为一款通用的图数据库产品,HugeGraph 需具备图数据库的基本功能。HugeGraph 支持 OLTP 和 OLAP 两种图计算类型,其中 OLTP 实现了 <a href=https://tinkerpop.apache.org>Apache TinkerPop3</a> 框架,支持 <a href=https://tinkerpop.apache.org/gremlin.html>Gremlin</a><a href=https://en.wikipedia.org/wiki/Cypher>Cypher</a> 查询语言,拥有功能齐全的应用工具链,还提供了插件式后端存储驱动框架。</p><p>下面是 HugeGraph 的整体架构图:</p><div style=text-align:center><img src=/docs/images/design/architectural-revised.png alt=image></div><p>HugeGraph 包括三个层次的功能,分别是应用程序层、图引擎层和存储层。</p><ul><li>应用程序层:<ul><li><a href=/docs/quickstart/hugegraph-hubble/>Hubble</a>: 一站式可视化分析平台,平台涵盖了从数据建模,到数据快速导入,再到数据的在线、离线分析、以及图的统一管理的全过程,实现了图应用的全流程向导式操作。</li><li><a href=/docs/quickstart/hugegraph-loader/>Loader</a>: 数据导入组件,能够将多种数据源的数据转化为图的顶点和边并批量导入到图数据库中。</li><li><a href=/docs/quickstart/hugegraph-tools/>Tools</a>: 命令行工具,用于部署、管理和备份/恢复 HugeGraph 中的数据。</li><li><a href=/docs/quickstart/hugegraph-computer/>Computer</a>: 分布式图处理系统 (OLAP),它是 <a href=https://kowshik.github.io/JPregel/pregel_paper.pdf>Pregel</a> 的一个实现,可以运行在 Kubernetes 上。</li><li><a href=/docs/quickstart/hugegraph-client/>Client</a>: 使用 Java 编写的 HugeGraph 客户端,用户可以使用 Client 编写 Java 代码操作 HugeGraph,后续可根据需要提供 Python、Go、C++ 等多语言支持。</li></ul></li><li><a href=/docs/quickstart/hugegraph-server/>图引擎层</a><ul><li>REST Server: 提供 RESTful API 用于查询 Graph/Schema 等信息,支持 <a href=https://tinkerpop.apache.org/gremlin.html>Gremlin</a><a href=https://en.wikipedia.org/wiki/Cypher>Cypher</a> 查询语言,提供服务监控和运维的 APIs。</li><li>Graph Engine: 支持 OLTP 和 OLAP 两种图计算类型,其中 OLTP 实现了 <a href=https://tinkerpop.apache.org>Apache TinkerPop3</a> 框架。</li><li>Backend Interface: 实现将图数据存储到后端。</li></ul></li><li>存储层:<ul><li>Storage Backend: 支持多种内置存储后端 (RocksDB/MySQL/HBase/&mldr;),也允许用户无需更改现有源码的情况下扩展自定义后端。</li></ul></li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-3d0f9ef831ef5d7d11acfb09140359fa>6.2 - HugeGraph Design Concepts</h1><h3 id=1-property-graph>1. Property Graph</h3><p>常见的图数据表示模型有两种,分别是RDF(Resource Description Framework)模型和属性图(Property Graph)模型。
RDF和Property Graph都是最基础、最有名的图表示模式,都能够表示各种图的实体关系建模。
RDF是W3C标准,而Property Graph是工业标准,受到广大图数据库厂商的广泛支持。HugeGraph目前采用Property Graph。</p><p>HugeGraph对应的存储概念模型也是参考Property Graph而设计的,具体示例详见下图:(<em>此图为旧版设计已过时,请忽略它,后续更新</em></p><p><img src=/docs/images/design/PropertyGraph.png alt=image></p><p>在HugeGraph内部,每个顶点 / 边由唯一的 VertexId / EdgeId 标识,属性存储在对应点 / 边内部。而顶点与顶点之间的关系 / 映射则是通过边来存储的。</p><p>顶点属性值通过边指针方式存储时,如果要更新一个顶点特定的属性值直接通过覆盖写入即可,其弊端是冗余存储了VertexId;
如果要更新关系的属性需要通过read-and-modify方式,先读取所有属性,修改部分属性,然后再写入存储系统,更新效率较低。
从经验来看顶点属性的修改需求较多,而边的属性修改需求较少,例如PageRank和Graph Cluster等计算都需要频繁修改顶点的属性值。</p><h3 id=2-图分区方案>2. 图分区方案</h3><p>对于分布式图数据库而言,图的分区存储方式有两种:分别是边分割存储(Edge Cut)和点分割存储(Vertex Cut),如下图所示。
使用Edge Cut方式存储图时,任何一个顶点只会出现在一台机器上,而边可能分布在不同机器上,这种存储方式有可能导致边多次存储。
使用Vertex Cut方式存储图时,任何一条边只会出现在一台机器上,而每相同的一个点可能分布到不同机器上,这种存储方式可能会导致顶点多次存储。</p><p><img src=/docs/images/design/GraphCut.png alt=image></p><p>采用EdgeCut分区方案可以支持高性能的插入和更新操作,而VertexCut分区方案更适合静态图查询分析,因此EdgeCut适合OLTP图查询,VertexCut更适合OLAP的图查询。
HugeGraph目前采用EdgeCut的分区方案。</p><h3 id=3-vertexid-策略>3. VertexId 策略</h3><p>HugeGraph的Vertex支持三种ID策略,在同一个图数据库中不同的VertexLabel可以使用不同的Id策略,目前HugeGraph支持的Id策略分别是:</p><ul><li>自动生成(AUTOMATIC):使用Snowflake算法自动生成全局唯一Id,Long类型;</li><li>主键(PRIMARY_KEY):通过VertexLabel+PrimaryKeyValues生成Id,String类型;</li><li>自定义(CUSTOMIZE_STRING|CUSTOMIZE_NUMBER):用户自定义Id,分为String和Long类型两种,需自己保证Id的唯一性;</li></ul><p>默认的Id策略是AUTOMATIC,如果用户调用primaryKeys()方法并设置了正确的PrimaryKeys,则自动启用PRIMARY_KEY策略。
启用PRIMARY_KEY策略后HugeGraph能根据PrimaryKeys实现数据去重。</p><ol><li>AUTOMATIC ID策略</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>useAutomaticId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>18</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><ol start=2><li>PRIMARY_KEY ID策略</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>usePrimaryKeyId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>18</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><ol start=3><li>CUSTOMIZE_STRING ID策略</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>useCustomizeStringId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;123456&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>18</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><ol start=4><li>CUSTOMIZE_NUMBER ID策略</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>useCustomizeNumberId</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;person&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>id</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>123456</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;marko&#34;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>18</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;city&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Beijing&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><p>如果用户需要Vertex去重,有三种方案分别是:</p><ol><li>采用PRIMARY_KEY策略,自动覆盖,适合大数据量批量插入,用户无法知道是否发生了覆盖行为</li><li>采用AUTOMATIC策略,read-and-modify,适合小数据量插入,用户可以明确知道是否发生覆盖</li><li>采用CUSTOMIZE_STRING或CUSTOMIZE_NUMBER策略,用户自己保证唯一</li></ol><h3 id=4-edgeid-策略>4. EdgeId 策略</h3><p>HugeGraph的EdgeId是由<code>srcVertexId</code>+<code>edgeLabel</code>+<code>sortKey</code>+<code>tgtVertexId</code>四部分组合而成。其中<code>sortKey</code>是HugeGraph的一个重要概念。
在Edge中加入<code>sortKey</code>作为Edge的唯一标识的原因有两个:</p><ol><li>如果两个顶点之间存在多条相同Label的边可通过<code>sortKey</code>来区分</li><li>对于SuperNode的节点,可以通过<code>sortKey</code>来排序截断。</li></ol><p>由于EdgeId是由<code>srcVertexId</code>+<code>edgeLabel</code>+<code>sortKey</code>+<code>tgtVertexId</code>四部分组合,多次插入相同的Edge时HugeGraph会自动覆盖以实现去重。
需要注意的是如果批量插入模式下Edge的属性也将会覆盖。</p><p>另外由于HugeGraph的EdgeId采用自动去重策略,对于self-loop(一个顶点存在一条指向自身的边)的情况下HugeGraph认为仅有一条边,对于采用AUTOMATIC策略的图数据库(例如TitianDB
)则会认为该图存在两条边。</p><blockquote><p>HugeGraph的边仅支持有向边,无向边可以创建Out和In两条边来实现。</p></blockquote><h3 id=5-hugegraph-transaction-overview>5. HugeGraph transaction overview</h3><h5 id=tinkerpop事务概述>TinkerPop事务概述</h5><p>TinkerPop transaction事务是指对数据库执行操作的工作单元,一个事务内的一组操作要么执行成功,要么全部失败。
详细介绍请参考TinkerPop官方文档:http://tinkerpop.apache.org/docs/current/reference/#transactions</p><h5 id=tinkerpop事务操作接口>TinkerPop事务操作接口</h5><ul><li>open 打开事务</li><li>commit 提交事务</li><li>rollback 回滚事务</li><li>close 关闭事务</li></ul><h5 id=tinkerpop事务规范>TinkerPop事务规范</h5><ul><li>事务必须显式提交后才可生效(未提交时修改操作只有本事务内查询可看到)</li><li>事务必须打开之后才可提交或回滚</li><li>如果事务设置自动打开则无需显式打开(默认方式),如果设置手动打开则必须显式打开</li><li>可设置事务关闭时:自动提交、自动回滚(默认方式)、手动(禁止显式关闭)等3种模式</li><li>事务在提交或回滚后必须是关闭状态</li><li>事务在查询后必须是打开状态</li><li>事务(非threaded tx)必须线程隔离,多线程操作同一事务互不影响</li></ul><p>更多事务规范用例见:<a href=https://github.com/apache/tinkerpop/blob/master/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java>Transaction Test</a></p><h5 id=hugegraph事务实现>HugeGraph事务实现</h5><ul><li>一个事务中所有的操作要么成功要么失败</li><li>一个事务只能读取到另外一个事务已提交的内容(Read committed)</li><li>所有未提交的操作均能在本事务中查询出来,包括:<ul><li>增加顶点能够查询出该顶点</li><li>删除顶点能够过滤掉该顶点</li><li>删除顶点能够过滤掉该顶点相关边</li><li>增加边能够查询出该边</li><li>删除边能够过滤掉该边</li><li>增加/修改(顶点、边)属性能够在查询时生效</li><li>删除(顶点、边)属性能够在查询时生效</li></ul></li><li>所有未提交的操作在事务回滚后均失效,包括:<ul><li>顶点、边的增加、删除</li><li>属性的增加/修改、删除</li></ul></li></ul><p>示例:一个事务无法读取另一个事务未提交的内容</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>testUncommittedTx</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#204a87;font-weight:700>throws</span> <span style=color:#000>InterruptedException</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>CountDownLatch</span> <span style=color:#000>latchUncommit</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>CountDownLatch</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>CountDownLatch</span> <span style=color:#000>latchRollback</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>CountDownLatch</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Thread</span> <span style=color:#000>thread</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>Thread</span><span style=color:#ce5c00;font-weight:700>(()</span> <span style=color:#ce5c00;font-weight:700>-&gt;</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// this is a new transaction in the new thread
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>tx</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>open</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;current transaction operations&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>james</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;author&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;id&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;James Gosling&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>62</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;lived&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;Canadian&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>Vertex</span> <span style=color:#000>java</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;language&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;java&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;versions&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>Arrays</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>asList</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>6</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>7</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>8</span><span style=color:#ce5c00;font-weight:700>));</span>
</span></span><span style=display:flex><span> <span style=color:#000>james</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;created&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// we can query the uncommitted records in the current transaction
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;current transaction assert&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertices</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>==</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edges</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>==</span> <span style=color:#204a87;font-weight:700>true</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>latchUncommit</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>countDown</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>try</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>latchRollback</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>await</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span> <span style=color:#204a87;font-weight:700>catch</span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>InterruptedException</span> <span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>throw</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>RuntimeException</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>e</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;current transaction rollback&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>tx</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>rollback</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>});</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>thread</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>start</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// query none result in other transaction when not commit()
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>latchUncommit</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>await</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;other transaction assert for uncommitted&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#ce5c00;font-weight:700>!</span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertices</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#ce5c00;font-weight:700>!</span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edges</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#000>latchRollback</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>countDown</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>thread</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>join</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// query none result in other transaction after rollback()
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>System</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>println</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;other transaction assert for rollback&#34;</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#ce5c00;font-weight:700>!</span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertices</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>assert</span> <span style=color:#ce5c00;font-weight:700>!</span><span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edges</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasNext</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=事务实现原理>事务实现原理</h5><ul><li>服务端内部通过将事务与线程绑定实现隔离(ThreadLocal)</li><li>本事务未提交的内容按照时间顺序覆盖老数据以供本事务查询最新版本数据</li><li>底层依赖后端数据库保证事务原子性操作(如Cassandra/RocksDB的batch接口均保证原子性)</li></ul><h6 id=注意><em>注意</em></h6><blockquote><p>RESTful API暂时未暴露事务接口</p></blockquote><blockquote><p>TinkerPop API允许打开事务,请求完成时会自动关闭(Gremlin Server强制关闭)</p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-96a920d19e01666d95eded506d502ab4>6.3 - HugeGraph Plugin 机制及插件扩展流程</h1><h3 id=背景>背景</h3><ol><li>HugeGraph 不仅开源开放,而且要做到简单易用,一般用户无需更改源码也能轻松增加插件扩展功能。</li><li>HugeGraph 支持多种内置存储后端,也允许用户无需更改现有源码的情况下扩展自定义后端。</li><li>HugeGraph 支持全文检索,全文检索功能涉及到各语言分词,目前已内置 8 种中文分词器,也允许用户无需更改现有源码的情况下扩展自定义分词器。</li></ol><h3 id=可扩展维度>可扩展维度</h3><p>目前插件方式提供如下几个维度的扩展项:</p><ul><li>后端存储</li><li>序列化器</li><li>自定义配置项</li><li>分词器</li></ul><h3 id=插件实现机制>插件实现机制</h3><ol><li>HugeGraph 提供插件接口 HugeGraphPlugin,通过 Java SPI 机制支持插件化</li><li>HugeGraph 提供了 4 个扩展项注册函数:<code>registerOptions()</code><code>registerBackend()</code><code>registerSerializer()</code><code>registerAnalyzer()</code></li><li>插件实现者实现相应的 Options、Backend、Serializer 或 Analyzer 的接口</li><li>插件实现者实现 HugeGraphPlugin 接口的<code>register()</code>方法,在该方法中注册上述第 3 点所列的具体实现类,并打成 jar 包</li><li>插件使用者将 jar 包放在 HugeGraph Server 安装目录的<code>plugins</code>目录下,修改相关配置项为插件自定义值,重启即可生效</li></ol><h3 id=插件实现流程实例>插件实现流程实例</h3><h4 id=1-新建一个-maven-项目>1 新建一个 maven 项目</h4><h5 id=11-项目名称取名hugegraph-plugin-demo>1.1 项目名称取名:hugegraph-plugin-demo</h5><h5 id=12-添加hugegraph-core-jar-包依赖>1.2 添加<code>hugegraph-core</code> Jar 包依赖</h5><p>maven pom.xml 详细内容如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-xml data-lang=xml><span style=display:flex><span><span style=color:#8f5902;font-style:italic>&lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&gt;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&lt;project</span> <span style=color:#c4a000>xmlns=</span><span style=color:#4e9a06>&#34;http://maven.apache.org/POM/4.0.0&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#c4a000>xmlns:xsi=</span><span style=color:#4e9a06>&#34;http://www.w3.org/2001/XMLSchema-instance&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#c4a000>xsi:schemaLocation=</span><span style=color:#4e9a06>&#34;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&#34;</span><span style=color:#204a87;font-weight:700>&gt;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;modelVersion&gt;</span>4.0.0<span style=color:#204a87;font-weight:700>&lt;/modelVersion&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;groupId&gt;</span>org.apache.hugegraph<span style=color:#204a87;font-weight:700>&lt;/groupId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;artifactId&gt;</span>hugegraph-plugin-demo<span style=color:#204a87;font-weight:700>&lt;/artifactId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;version&gt;</span>1.0.0<span style=color:#204a87;font-weight:700>&lt;/version&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;packaging&gt;</span>jar<span style=color:#204a87;font-weight:700>&lt;/packaging&gt;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;name&gt;</span>hugegraph-plugin-demo<span style=color:#204a87;font-weight:700>&lt;/name&gt;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;dependencies&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;dependency&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;groupId&gt;</span>org.apache.hugegraph<span style=color:#204a87;font-weight:700>&lt;/groupId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;artifactId&gt;</span>hugegraph-core<span style=color:#204a87;font-weight:700>&lt;/artifactId&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;version&gt;</span>${project.version}<span style=color:#204a87;font-weight:700>&lt;/version&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;/dependency&gt;</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&lt;/dependencies&gt;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>&lt;/project&gt;</span>
</span></span></code></pre></div><h4 id=2-实现扩展功能>2 实现扩展功能</h4><h5 id=21-扩展自定义后端>2.1 扩展自定义后端</h5><h6 id=211-实现接口-backendstoreprovider>2.1.1 实现接口 BackendStoreProvider</h6><ul><li>可实现接口:<code>org.apache.hugegraph.backend.store.BackendStoreProvider</code></li><li>或者继承抽象类:<code>org.apache.hugegraph.backend.store.AbstractBackendStoreProvider</code></li></ul><p>以 RocksDB 后端 RocksDBStoreProvider 为例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>RocksDBStoreProvider</span> <span style=color:#204a87;font-weight:700>extends</span> <span style=color:#000>AbstractBackendStoreProvider</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>protected</span> <span style=color:#000>String</span> <span style=color:#000>database</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#204a87;font-weight:700>this</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>graph</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>toLowerCase</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>protected</span> <span style=color:#000>BackendStore</span> <span style=color:#000>newSchemaStore</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span> <span style=color:#000>store</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>RocksDBSchemaStore</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#204a87;font-weight:700>this</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>this</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>database</span><span style=color:#ce5c00;font-weight:700>(),</span> <span style=color:#000>store</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>protected</span> <span style=color:#000>BackendStore</span> <span style=color:#000>newGraphStore</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span> <span style=color:#000>store</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>RocksDBGraphStore</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#204a87;font-weight:700>this</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#204a87;font-weight:700>this</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>database</span><span style=color:#ce5c00;font-weight:700>(),</span> <span style=color:#000>store</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>type</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#4e9a06>&#34;rocksdb&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>version</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#4e9a06>&#34;1.0&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=212-实现接口-backendstore>2.1.2 实现接口 BackendStore</h6><p>BackendStore 接口定义如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>interface</span> <span style=color:#000>BackendStore</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Store name
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>store</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Database name
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>database</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Get the parent provider
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendStoreProvider</span> <span style=color:#000>provider</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Open/close database
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>open</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeConfig</span> <span style=color:#000>config</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>close</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Initialize/clear database
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>init</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>clear</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Add/delete data
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>mutate</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>BackendMutation</span> <span style=color:#000>mutation</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Query data
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>Iterator</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>BackendEntry</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>query</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>Query</span> <span style=color:#000>query</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Transaction
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>beginTx</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>commitTx</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>rollbackTx</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Get metadata by key
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>R</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>R</span> <span style=color:#000>metadata</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeType</span> <span style=color:#000>type</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>String</span> <span style=color:#000>meta</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>Object</span><span style=color:#ce5c00;font-weight:700>[]</span> <span style=color:#000>args</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Backend features
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendFeatures</span> <span style=color:#000>features</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// Generate an id for a specific type
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>Id</span> <span style=color:#000>nextId</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeType</span> <span style=color:#000>type</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=213-扩展自定义序列化器>2.1.3 扩展自定义序列化器</h6><p>序列化器必须继承抽象类:<code>org.apache.hugegraph.backend.serializer.AbstractSerializer</code>(<code>implements GraphSerializer, SchemaSerializer</code>)
主要接口的定义如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>interface</span> <span style=color:#000>GraphSerializer</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeVertex</span> <span style=color:#000>vertex</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeVertexProperty</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeVertexProperty</span><span style=color:#ce5c00;font-weight:700>&lt;?&gt;</span> <span style=color:#000>prop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>HugeVertex</span> <span style=color:#000>readVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeEdge</span> <span style=color:#000>edge</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeEdgeProperty</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeEdgeProperty</span><span style=color:#ce5c00;font-weight:700>&lt;?&gt;</span> <span style=color:#000>prop</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>HugeEdge</span> <span style=color:#000>readEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeIndex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeIndex</span> <span style=color:#000>index</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>HugeIndex</span> <span style=color:#000>readIndex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>ConditionQuery</span> <span style=color:#000>query</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeId</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeType</span> <span style=color:#000>type</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>Id</span> <span style=color:#000>id</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>Query</span> <span style=color:#000>writeQuery</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>Query</span> <span style=color:#000>query</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>interface</span> <span style=color:#000>SchemaSerializer</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>VertexLabel</span> <span style=color:#000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>VertexLabel</span> <span style=color:#000>readVertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>EdgeLabel</span> <span style=color:#000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>EdgeLabel</span> <span style=color:#000>readEdgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writePropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>PropertyKey</span> <span style=color:#000>propertyKey</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>PropertyKey</span> <span style=color:#000>readPropertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>writeIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>IndexLabel</span> <span style=color:#000>indexLabel</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>IndexLabel</span> <span style=color:#000>readIndexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>HugeGraph</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>BackendEntry</span> <span style=color:#000>entry</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h6 id=214-扩展自定义配置项>2.1.4 扩展自定义配置项</h6><p>增加自定义后端时,可能需要增加新的配置项,实现流程主要包括:</p><ul><li>增加配置项容器类,并实现接口<code>org.apache.hugegraph.config.OptionHolder</code></li><li>提供单例方法<code>public static OptionHolder instance()</code>,并在对象初始化时调用方法<code>OptionHolder.registerOptions()</code></li><li>增加配置项声明,单值配置项类型为<code>ConfigOption</code>、多值配置项类型为<code>ConfigListOption</code></li></ul><p>以 RocksDB 配置项定义为例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>RocksDBOptions</span> <span style=color:#204a87;font-weight:700>extends</span> <span style=color:#000>OptionHolder</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>private</span> <span style=color:#000>RocksDBOptions</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>super</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>private</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>volatile</span> <span style=color:#000>RocksDBOptions</span> <span style=color:#000>instance</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>synchronized</span> <span style=color:#000>RocksDBOptions</span> <span style=color:#000>instance</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>if</span> <span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>instance</span> <span style=color:#ce5c00;font-weight:700>==</span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>instance</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>RocksDBOptions</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#000>instance</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>registerOptions</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#000>instance</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>ConfigOption</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>DATA_PATH</span> <span style=color:#ce5c00;font-weight:700>=</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>ConfigOption</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;(</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;rocksdb.data_path&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;The path for storing data of RocksDB.&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>disallowEmpty</span><span style=color:#ce5c00;font-weight:700>(),</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;rocksdb-data&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>ConfigOption</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>WAL_PATH</span> <span style=color:#ce5c00;font-weight:700>=</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>ConfigOption</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;(</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;rocksdb.wal_path&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;The path for storing WAL of RocksDB.&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>disallowEmpty</span><span style=color:#ce5c00;font-weight:700>(),</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;rocksdb-data&#34;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>final</span> <span style=color:#000>ConfigListOption</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>DATA_DISKS</span> <span style=color:#ce5c00;font-weight:700>=</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>ConfigListOption</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;(</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;rocksdb.data_disks&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>false</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;The optimized disks for storing data of RocksDB. &#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;The format of each element: `STORE/TABLE: /path/to/disk`.&#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;Allowed keys are [graph/vertex, graph/edge_out, graph/edge_in, &#34;</span> <span style=color:#ce5c00;font-weight:700>+</span>
</span></span><span style=display:flex><span> <span style=color:#4e9a06>&#34;graph/secondary_index, graph/range_index]&#34;</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>null</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>class</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#000>ImmutableList</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>of</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>);</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h5 id=22-扩展自定义分词器>2.2 扩展自定义分词器</h5><p>分词器需要实现接口<code>org.apache.hugegraph.analyzer.Analyzer</code>,以实现一个 SpaceAnalyzer 空格分词器为例。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>package</span> <span style=color:#000>org.apache.hugegraph.plugin</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.Arrays</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.HashSet</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>java.util.Set</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>import</span> <span style=color:#000>org.apache.hugegraph.analyzer.Analyzer</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>SpaceAnalyzer</span> <span style=color:#204a87;font-weight:700>implements</span> <span style=color:#000>Analyzer</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>Set</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>segment</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>String</span> <span style=color:#000>text</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#204a87;font-weight:700>new</span> <span style=color:#000>HashSet</span><span style=color:#ce5c00;font-weight:700>&lt;&gt;(</span><span style=color:#000>Arrays</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>asList</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>text</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>split</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34; &#34;</span><span style=color:#ce5c00;font-weight:700>)));</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=3-实现插件接口并进行注册>3. 实现插件接口,并进行注册</h4><p>插件注册入口为<code>HugeGraphPlugin.register()</code>,自定义插件必须实现该接口方法,在其内部注册上述定义好的扩展项。
接口<code>org.apache.hugegraph.plugin.HugeGraphPlugin</code>定义如下:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>interface</span> <span style=color:#000>HugeGraphPlugin</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>name</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>register</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>supportsMinVersion</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>supportsMaxVersion</span><span style=color:#ce5c00;font-weight:700>();</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><p>并且 HugeGraphPlugin 提供了 4 个静态方法用于注册扩展项:</p><ul><li>registerOptions(String name, String classPath):注册配置项</li><li>registerBackend(String name, String classPath):注册后端(BackendStoreProvider)</li><li>registerSerializer(String name, String classPath):注册序列化器</li><li>registerAnalyzer(String name, String classPath):注册分词器</li></ul><p>下面以注册 SpaceAnalyzer 分词器为例:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>package</span> <span style=color:#000>org.apache.hugegraph.plugin</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>class</span> <span style=color:#000>DemoPlugin</span> <span style=color:#204a87;font-weight:700>implements</span> <span style=color:#000>HugeGraphPlugin</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>name</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>return</span> <span style=color:#4e9a06>&#34;demo&#34;</span><span style=color:#ce5c00;font-weight:700>;</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@Override</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>register</span><span style=color:#ce5c00;font-weight:700>()</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#000>HugeGraphPlugin</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>registerAnalyzer</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;demo&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>SpaceAnalyzer</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>class</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>getName</span><span style=color:#ce5c00;font-weight:700>());</span>
</span></span><span style=display:flex><span> <span style=color:#ce5c00;font-weight:700>}</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>}</span>
</span></span></code></pre></div><h4 id=4-配置-spi-入口>4. 配置 SPI 入口</h4><ol><li>确保 services 目录存在:hugegraph-plugin-demo/resources/META-INF/services</li><li>在 services 目录下建立文本文件:org.apache.hugegraph.plugin.HugeGraphPlugin</li><li>文件内容如下:org.apache.hugegraph.plugin.DemoPlugin</li></ol><h4 id=5-打-jar-包>5. 打 Jar 包</h4><p>通过 maven 打包,在项目目录下执行命令<code>mvn package</code>,在 target 目录下会生成 Jar 包文件。
使用时将该 Jar 包拷到<code>plugins</code>目录,重启服务即可生效。</p></div><div class=td-content style=page-break-before:always><h1 id=pg-2c9db416c8d78f898d52c91ec12535d4>6.4 - Backup Restore</h1><h2 id=描述>描述</h2><p>Backup 和 Restore 是备份图和恢复图的功能。备份和恢复的数据包括元数据(schema)和图数据(vertex 和 edge)。</p><h4 id=backup>Backup</h4><p>将 HugeGraph 系统中的一张图的元数据和图数据以 JSON 格式导出。</p><h4 id=restore>Restore</h4><p>将 Backup 导出的JSON格式的数据,重新导入到 HugeGraph 系统中的一个图中。</p><p>Restore 有两种模式:</p><ul><li>Restoring 模式,将 Backup 导出的元数据和图数据原封不动的恢复到 HugeGraph 系统中。可用于图的备份和恢复,一般目标图是新图(没有元数据和图数据)。比如:<ul><li>系统升级,先备份图,然后升级系统,最后将图恢复到新的系统中</li><li>图迁移,从一个 HugeGraph 系统中,使用 Backup 功能将图导出,然后使用 Restore 功能将图导入另一个 HugeGraph 系统中</li></ul></li><li>Merging 模式,将 Backup 导出的元数据和图数据导入到另一个已经存在元数据或者图数据的图中,过程中元数据的 ID 可能发生改变,顶点和边的 ID 也会发生相应变化。<ul><li>可用于合并图</li></ul></li></ul><h2 id=使用方法>使用方法</h2><p>可以使用<a href=/docs/quickstart/hugegraph-tools>hugegraph-tools</a>进行图的备份和恢复。</p><h4 id=backup-1>Backup</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph backup -t all -d data
</span></span></code></pre></div><p>该命令将 http://127.0.0.1 的 hugegraph 图的全部元数据和图数据备份到data目录下。</p><blockquote><p>Backup 在三种图模式下都可以正常工作</p></blockquote><h4 id=restore-1>Restore</h4><p>Restore 有两种模式: RESTORING 和 MERGING,备份之前首先要根据需要设置图模式。</p><h5 id=步骤1查看并设置图模式>步骤1:查看并设置图模式</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph graph-mode-get
</span></span></code></pre></div><p>该命令用于查看当前图模式,包括:NONE、RESTORING、MERGING。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph graph-mode-set -m RESTORING
</span></span></code></pre></div><p>该命令用于设置图模式,Restore 之前可以设置成 RESTORING 或者 MERGING 模式,例子中设置成 RESTORING。</p><h5 id=步骤2restore-数据>步骤2:Restore 数据</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph restore -t all -d data
</span></span></code></pre></div><p>该命令将data目录下的全部元数据和图数据重新导入到 http://127.0.0.1 的 hugegraph 图中。</p><h5 id=步骤3恢复图模式>步骤3:恢复图模式</h5><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>bin/hugegraph graph-mode-set -m NONE
</span></span></code></pre></div><p>该命令用于恢复图模式为 NONE。</p><p>至此,一次完整的图备份和图恢复流程结束。</p><h4 id=帮助>帮助</h4><p>备份和恢复命令的详细使用方式可以参考<a href=/docs/quickstart/hugegraph-tools>hugegraph-tools文档</a></p><h2 id=backuprestore使用和实现的api说明>Backup/Restore使用和实现的API说明</h2><h4 id=backup-2>Backup</h4><p>Backup 使用<code>元数据</code><code>图数据</code>的相应的 list(GET) API 导出,并未增加新的 API。</p><h4 id=restore-2>Restore</h4><p>Restore 使用<code>元数据</code><code>图数据</code>的相应的 create(POST) API 导入,并未增加新的 API。</p><p>Restore 时存在两种不同的模式: Restoring 和 Merging,另外,还有常规模式 NONE(默认),区别如下:</p><ul><li>None 模式,元数据和图数据的写入属于正常状态,可参见功能说明。特别的:<ul><li>元数据(schema)创建时不允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,不允许指定 ID</li></ul></li><li>Restoring 模式,恢复到一个新图中,特别的:<ul><li>元数据(schema)创建时允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,允许指定 ID</li></ul></li><li>Merging 模式,合并到一个已存在元数据和图数据的图中,特别的:<ul><li>元数据(schema)创建时不允许指定 ID</li><li>图数据(vertex)在 id strategy 为 Automatic 时,允许指定 ID</li></ul></li></ul><p>正常情况下,图模式为 None,当需要 Restore 图时,需要根据需要临时修改图模式为 Restoring 模式或者 Merging 模式,并在完成 Restore 时,恢复图模式为 None。</p><p>实现的设置图模式的 RESTful API 如下:</p><h5 id=查看某个图的模式-该操作需要管理员权限>查看某个图的模式. <strong>该操作需要管理员权限</strong></h5><h6 id=method--url>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>GET http://localhost:8080/graphs/{graph}/mode
</span></span></code></pre></div><h6 id=response-status>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mode&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;NONE&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div><blockquote><p>合法的图模式包括:NONE,RESTORING,MERGING</p></blockquote><h5 id=设置某个图的模式-该操作需要管理员权限>设置某个图的模式. <strong>该操作需要管理员权限</strong></h5><h6 id=method--url-1>Method & Url</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>PUT http://localhost:8080/graphs/{graph}/mode
</span></span></code></pre></div><h6 id=request-body>Request Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>&#34;RESTORING&#34;
</span></span></code></pre></div><blockquote><p>合法的图模式包括:NONE,RESTORING,MERGING</p></blockquote><h6 id=response-status-1>Response Status</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#0000cf;font-weight:700>200</span>
</span></span></code></pre></div><h6 id=response-body-1>Response Body</h6><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-json data-lang=json><span style=display:flex><span><span style=color:#000;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#204a87;font-weight:700>&#34;mode&#34;</span><span style=color:#000;font-weight:700>:</span> <span style=color:#4e9a06>&#34;RESTORING&#34;</span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>}</span>
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-3465b699399f48689cdc6b5e59a10d69>6.5 - FAQ</h1><ul><li><p>如何选择后端存储? 选 RocksDB 还是 Cassandra 还是 Hbase 还是 Mysql?</p><p>根据你的具体需要来判断, 一般单机或数据量 &lt; 100 亿推荐 RocksDB, 其他推荐使用分布式存储的后端集群</p></li><li><p>启动服务时提示:<code>xxx (core dumped) xxx</code></p><p>请检查JDK版本是否为 Java11 (至少是Java8)</p></li><li><p>启动服务成功了,但是操作图时有类似于"无法连接到后端或连接未打开"的提示</p><p>第一次启动服务前,需要先使用<code>init-store</code>初始化后端,后续版本会将提示得更清晰直接。</p></li><li><p>所有的后端在使用前都需要执行<code>init-store</code>吗,序列化的选择可以随意填写么?</p><p>除了<code>memory</code>不需要,其他后端均需要,如:<code>cassandra</code><code>hbase</code><code>rocksdb</code>等,序列化需一一对应不可随意填写。</p></li><li><p>执行<code>init-store</code>报错:<code>Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/librocksdbjni3226083071221514754.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.10' not found (required by /tmp/librocksdbjni3226083071221514754.so)</code></p><p>RocksDB需要 gcc 4.3.0 (GLIBCXX_3.4.10) 及以上版本</p></li><li><p>执行<code>init-store.sh</code>时报错:<code>NoHostAvailableException</code></p><p><code>NoHostAvailableException</code> 是指无法连接到<code>Cassandra</code>服务,如果确定是要使用<code>cassandra</code>后端,请先安装并启动这个服务。至于这个提示本身可能不够直白,我们会更新到文档进行说明的。</p></li><li><p><code>bin</code>目录下包含<code>start-hugegraph.sh</code><code>start-restserver.sh</code><code>start-gremlinserver.sh</code>三个似乎与启动有关的脚本,到底该使用哪个</p><p>自0.3.3版本以来,已经把 GremlinServer 和 RestServer 合并为 HugeGraphServer 了,使用<code>start-hugegraph.sh</code>启动即可,后两个在后续版本会被删掉。</p></li><li><p>配置了两个图,名字是<code>hugegraph</code><code>hugegraph1</code>,而启动服务的命令是<code>start-hugegraph.sh</code>,是只打开了<code>hugegraph</code>这个图吗</p><p><code>start-hugegraph.sh</code>会打开所有<code>gremlin-server.yaml</code><code>graphs</code>下的图,这二者并无名字上的直接关系</p></li><li><p>服务启动成功后,使用<code>curl</code>查询所有顶点时返回乱码</p><p>服务端返回的批量顶点/边是压缩(gzip)过的,可以使用管道重定向至 <code>gunzip</code> 进行解压(<code>curl http://example | gunzip</code>),也可以用<code>Firefox</code><code>postman</code>或者<code>Chrome</code>浏览器的<code>restlet</code>插件发请求,会自动解压缩响应数据。</p></li><li><p>使用顶点Id通过<code>RESTful API</code>查询顶点时返回空,但是顶点确实是存在的</p><p>检查顶点Id的类型,如果是字符串类型,<code>API</code><code>url</code>中的id部分需要加上双引号,数字类型则不用加。</p></li><li><p>已经根据需要给顶点Id加上了双引号,但是通过<code>RESTful API</code>查询顶点时仍然返回空</p><p>检查顶点id中是否包含<code>+</code><code>空格</code><code>/</code><code>?</code><code>%</code><code>&</code><code>=</code>这些URL的保留字符,如果存在则需要进行编码。下表给出了编码值:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>特殊字符 | 编码值
</span></span><span style=display:flex><span>--------| ----
</span></span><span style=display:flex><span>+ | %2B
</span></span><span style=display:flex><span>空格 | %20
</span></span><span style=display:flex><span>/ | %2F
</span></span><span style=display:flex><span>? | %3F
</span></span><span style=display:flex><span>% | %25
</span></span><span style=display:flex><span># | %23
</span></span><span style=display:flex><span>&amp; | %26
</span></span><span style=display:flex><span>= | %3D
</span></span></code></pre></div></li><li><p>查询某一类别的顶点或边(<code>query by label</code>)时提示超时</p><p>由于属于某一label的数据量可能比较多,请加上limit限制。</p></li><li><p>通过<code>RESTful API</code>操作图是可以的,但是发送<code>Gremlin</code>语句就报错:<code>Request Failed(500)</code></p><p>可能是<code>GremlinServer</code>的配置有误,检查<code>gremlin-server.yaml</code><code>host</code><code>port</code>是否与<code>rest-server.properties</code><code>gremlinserver.url</code>匹配,如不匹配则修改,然后重启服务。</p></li><li><p>使用<code>Loader</code>导数据出现<code>Socket Timeout</code>异常,然后导致<code>Loader</code>中断</p><p>持续地导入数据会使<code>Server</code>的压力过大,然后导致有些请求超时。可以通过调整<code>Loader</code>的参数来适当缓解<code>Server</code>压力(如:重试次数,重试间隔,错误容忍数等),降低该问题出现频率。</p></li><li><p>如何删除全部的顶点和边,RESTful API中没有这样的接口,调用<code>gremlin</code><code>g.V().drop()</code>会报错<code>Vertices in transaction have reached capacity xxx</code></p><p>目前确实没有好办法删除全部的数据,用户如果是自己部署的<code>Server</code>和后端,可以直接清空数据库,重启<code>Server</code>。可以使用paging API或scan API先获取所有数据,再逐条删除。</p></li><li><p>清空了数据库,并且执行了<code>init-store</code>,但是添加<code>schema</code>时提示"xxx has existed"</p><p><code>HugeGraphServer</code>内是有缓存的,清空数据库的同时是需要重启<code>Server</code>的,否则残留的缓存会产生不一致。</p></li><li><p>插入顶点或边的过程中报错:<code>Id max length is 128, but got xxx {yyy}</code><code>Big id max length is 32768, but got xxx</code></p><p>为了保证查询性能,目前的后端存储对id列的长度做了限制,顶点id不能超过128字节,边id长度不能超过32768字节,索引id不能超过128字节。</p></li><li><p>是否支持嵌套属性,如果不支持,是否有什么替代方案</p><p>嵌套属性目前暂不支持。替代方案:可以把嵌套属性作为单独的顶点拿出来,然后用边连接起来。</p></li><li><p>一个<code>EdgeLabel</code>是否可以连接多对<code>VertexLabel</code>,比如"投资"关系,可以是"个人"投资"企业",也可以是"企业"投资"企业"</p><p>一个<code>EdgeLabel</code>不支持连接多对<code>VertexLabel</code>,需要用户将<code>EdgeLabel</code>拆分得更细一点,如:&ldquo;个人投资&rdquo;,&ldquo;企业投资&rdquo;。</p></li><li><p>通过<code>RestAPI</code>发送请求时提示<code>HTTP 415 Unsupported Media Type</code></p><p>请求头中需要指定<code>Content-Type:application/json</code></p></li></ul><p>其他问题可以在对应项目的 issue 区搜索,例如 <a href=https://github.com/apache/hugegraph/issues>Server-Issues</a> / <a href=https://github.com/apache/hugegraph-toolchain/issues>Loader Issues</a></p></div><div class=td-content style=page-break-before:always><h1 id=pg-d54c862d45861ca39a945d90325e3909>6.6 - 报告安全问题</h1><h2 id=报告-apache-hugegraph-的安全问题>报告 Apache HugeGraph 的安全问题</h2><p>遵循 ASF 的规范,HugeGraph 社区对<strong>解决修复</strong>项目中的安全问题保持非常积极和开放的态度。</p><p>我们强烈建议用户首先向我们的独立安全邮件列表报告此类问题,相关详细的流程规范请参考 <a href=https://www.apache.org/security/committers.html>ASF SEC</a> 守则。</p><p>请注意,安全邮件组适用于报告<strong>未公开</strong>的安全漏洞并跟进漏洞处理的过程。常规的软件 <code>Bug/Error</code> 报告应该使用 <code>Github Issue/Discussion</code>
或是 <code>HugeGraph-Dev</code> 邮箱组。发送到安全邮件组但与安全问题无关的邮件将被忽略。</p><p>独立的安全邮件 (组) 地址为: <code>security@hugegraph.apache.org</code></p><p>安全漏洞处理大体流程如下:</p><ul><li>报告人私下向 Apache HugeGraph SEC 邮件组报告漏洞 (尽可能包括复现的版本/相关说明/复现方式/影响范围等)</li><li>HugeGraph 项目安全团队与报告人私下合作/商讨漏洞解决方案 (初步确认后可申请 <code>CVE</code> 编号予以登记)</li><li>项目创建一个新版本的受漏洞影响的软件包,以提供修复程序</li><li>合适的时间可公开漏洞的大体问题 & 描述如何应用修复程序 (遵循 ASF 规范,公告中不应携带复现细节等敏感信息)</li><li>正式的 CVE 发布及相关流程同 ASF-SEC 页面</li></ul><h2 id=已发现的安全漏洞-cves>已发现的安全漏洞 (CVEs)</h2><h3 id=hugegraphhttpsgithubcomapachehugegraph-主仓库-serverpdstore><a href=https://github.com/apache/hugegraph>HugeGraph</a> 主仓库 (Server/PD/Store)</h3><ul><li><a href="https://www.cve.org/CVERecord?id=CVE-2024-27348">CVE-2024-27348</a>: HugeGraph-Server - Command execution in gremlin</li><li><a href="https://www.cve.org/CVERecord?id=CVE-2024-27349">CVE-2024-27349</a>: HugeGraph-Server - Bypass whitelist in Auth mode</li></ul><h3 id=hugegraph-toolchainhttpsgithubcomapachehugegraph-toolchain-仓库-hubbleloaderclienttools><a href=https://github.com/apache/hugegraph-toolchain>HugeGraph-Toolchain</a> 仓库 (Hubble/Loader/Client/Tools/..)</h3><ul><li><a href="https://www.cve.org/CVERecord?id=CVE-2024-27347">CVE-2024-27347</a>: HugeGraph-Hubble - SSRF in Hubble connection page</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-3ed7a32fc6a58bb9d03dcd00dc874ba8>7 - QUERY LANGUAGE</h1></div><div class=td-content><h1 id=pg-2696905b5b6cbdf2ad7f78085bd6baa9>7.1 - HugeGraph Gremlin</h1><h3 id=概述>概述</h3><p>HugeGraph支持<a href=https://tinkerpop.apache.org>Apache TinkerPop3</a>的图形遍历查询语言<a href=https://tinkerpop.apache.org/gremlin.html>Gremlin</a>。 SQL是关系型数据库查询语言,而Gremlin是一种通用的图数据库查询语言,Gremlin可用于创建图的实体(Vertex和Edge)、修改实体内部属性、删除实体,也可执行图的查询操作。</p><p>Gremlin可用于创建图的实体(Vertex和Edge)、修改实体内部属性、删除实体,更主要的是可用于执行图的查询及分析操作。</p><h3 id=tinkerpop-features>TinkerPop Features</h3><p>HugeGraph实现了TinkerPop框架,但是并没有实现TinkerPop所有的特性。</p><p>下表列出HugeGraph对TinkerPop各种特性的支持情况:</p><h3 id=graph-features>Graph Features</h3><table><thead><tr><th>Name</th><th>Description</th><th>Support</th></tr></thead><tbody><tr><td>Computer</td><td>Determines if the {@code Graph} implementation supports {@link GraphComputer} based processing</td><td>false</td></tr><tr><td>Transactions</td><td>Determines if the {@code Graph} implementations supports transactions.</td><td>true</td></tr><tr><td>Persistence</td><td>Determines if the {@code Graph} implementation supports persisting it&rsquo;s contents natively to disk.This feature does not refer to every graph&rsquo;s ability to write to disk via the Gremlin IO packages(.e.g. GraphML), unless the graph natively persists to disk via those options somehow. For example,TinkerGraph does not support this feature as it is a pure in-sideEffects graph.</td><td>true</td></tr><tr><td>ThreadedTransactions</td><td>Determines if the {@code Graph} implementation supports threaded transactions which allow a transaction be executed across multiple threads via {@link Transaction#createThreadedTx()}.</td><td>false</td></tr><tr><td>ConcurrentAccess</td><td>Determines if the {@code Graph} implementation supports more than one connection to the same instance at the same time. For example, Neo4j embedded does not support this feature because concurrent access to the same database files by multiple instances is not possible. However, Neo4j HA could support this feature as each new {@code Graph} instance coordinates with the Neo4j cluster allowing multiple instances to operate on the same database.</td><td>false</td></tr></tbody></table><h3 id=vertex-features>Vertex Features</h3><table><thead><tr><th>Name</th><th>Description</th><th>Support</th></tr></thead><tbody><tr><td>UserSuppliedIds</td><td>Determines if an {@link Element} can have a user defined identifier. Implementation that do not support this feature will be expected to auto-generate unique identifiers. In other words, if the {@link Graph} allows {@code graph.addVertex(id,x)} to work and thus set the identifier of the newly added {@link Vertex} to the value of {@code x} then this feature should return true. In this case, {@code x} is assumed to be an identifier data type that the {@link Graph} will accept.</td><td>false</td></tr><tr><td>NumericIds</td><td>Determines if an {@link Element} has numeric identifiers as their internal representation. In other words,if the value returned from {@link Element#id()} is a numeric value then this method should be return {@code true}. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>StringIds</td><td>Determines if an {@link Element} has string identifiers as their internal representation. In other words, if the value returned from {@link Element#id()} is a string value then this method should be return {@code true}. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>UuidIds</td><td>Determines if an {@link Element} has UUID identifiers as their internal representation. In other words,if the value returned from {@link Element#id()} is a {@link UUID} value then this method should be return {@code true}.Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>CustomIds</td><td>Determines if an {@link Element} has a specific custom object as their internal representation.In other words, if the value returned from {@link Element#id()} is a type defined by the graph implementations, such as OrientDB&rsquo;s {@code Rid}, then this method should be return {@code true}.Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>AnyIds</td><td>Determines if an {@link Element} any Java object is a suitable identifier. TinkerGraph is a good example of a {@link Graph} that can support this feature, as it can use any {@link Object} as a value for the identifier. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite. This setting should only return {@code true} if {@link #supportsUserSuppliedIds()} is {@code true}.</td><td>false</td></tr><tr><td>AddProperty</td><td>Determines if an {@link Element} allows properties to be added. This feature is set independently from supporting &ldquo;data types&rdquo; and refers to support of calls to {@link Element#property(String, Object)}.</td><td>true</td></tr><tr><td>RemoveProperty</td><td>Determines if an {@link Element} allows properties to be removed.</td><td>true</td></tr><tr><td>AddVertices</td><td>Determines if a {@link Vertex} can be added to the {@code Graph}.</td><td>true</td></tr><tr><td>MultiProperties</td><td>Determines if a {@link Vertex} can support multiple properties with the same key.</td><td>false</td></tr><tr><td>DuplicateMultiProperties</td><td>Determines if a {@link Vertex} can support non-unique values on the same key. For this value to be {@code true}, then {@link #supportsMetaProperties()} must also return true. By default this method, just returns what {@link #supportsMultiProperties()} returns.</td><td>false</td></tr><tr><td>MetaProperties</td><td>Determines if a {@link Vertex} can support properties on vertex properties. It is assumed that a graph will support all the same data types for meta-properties that are supported for regular properties.</td><td>false</td></tr><tr><td>RemoveVertices</td><td>Determines if a {@link Vertex} can be removed from the {@code Graph}.</td><td>true</td></tr></tbody></table><h3 id=edge-features>Edge Features</h3><table><thead><tr><th>Name</th><th>Description</th><th>Support</th></tr></thead><tbody><tr><td>UserSuppliedIds</td><td>Determines if an {@link Element} can have a user defined identifier. Implementation that do not support this feature will be expected to auto-generate unique identifiers. In other words, if the {@link Graph} allows {@code graph.addVertex(id,x)} to work and thus set the identifier of the newly added {@link Vertex} to the value of {@code x} then this feature should return true. In this case, {@code x} is assumed to be an identifier data type that the {@link Graph} will accept.</td><td>false</td></tr><tr><td>NumericIds</td><td>Determines if an {@link Element} has numeric identifiers as their internal representation. In other words,if the value returned from {@link Element#id()} is a numeric value then this method should be return {@code true}. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>StringIds</td><td>Determines if an {@link Element} has string identifiers as their internal representation. In other words, if the value returned from {@link Element#id()} is a string value then this method should be return {@code true}. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>UuidIds</td><td>Determines if an {@link Element} has UUID identifiers as their internal representation. In other words,if the value returned from {@link Element#id()} is a {@link UUID} value then this method should be return {@code true}.Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>CustomIds</td><td>Determines if an {@link Element} has a specific custom object as their internal representation.In other words, if the value returned from {@link Element#id()} is a type defined by the graph implementations, such as OrientDB&rsquo;s {@code Rid}, then this method should be return {@code true}.Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite.</td><td>false</td></tr><tr><td>AnyIds</td><td>Determines if an {@link Element} any Java object is a suitable identifier. TinkerGraph is a good example of a {@link Graph} that can support this feature, as it can use any {@link Object} as a value for the identifier. Note that this feature is most generally used for determining the appropriate tests to execute in the Gremlin Test Suite. This setting should only return {@code true} if {@link #supportsUserSuppliedIds()} is {@code true}.</td><td>false</td></tr><tr><td>AddProperty</td><td>Determines if an {@link Element} allows properties to be added. This feature is set independently from supporting &ldquo;data types&rdquo; and refers to support of calls to {@link Element#property(String, Object)}.</td><td>true</td></tr><tr><td>RemoveProperty</td><td>Determines if an {@link Element} allows properties to be removed.</td><td>true</td></tr><tr><td>AddEdges</td><td>Determines if an {@link Edge} can be added to a {@code Vertex}.</td><td>true</td></tr><tr><td>RemoveEdges</td><td>Determines if an {@link Edge} can be removed from a {@code Vertex}.</td><td>true</td></tr></tbody></table><h3 id=data-type-features>Data Type Features</h3><table><thead><tr><th>Name</th><th>Description</th><th>Support</th></tr></thead><tbody><tr><td>BooleanValues</td><td></td><td>true</td></tr><tr><td>ByteValues</td><td></td><td>true</td></tr><tr><td>DoubleValues</td><td></td><td>true</td></tr><tr><td>FloatValues</td><td></td><td>true</td></tr><tr><td>IntegerValues</td><td></td><td>true</td></tr><tr><td>LongValues</td><td></td><td>true</td></tr><tr><td>MapValues</td><td>Supports setting of a {@code Map} value. The assumption is that the {@code Map} can contain arbitrary serializable values that may or may not be defined as a feature itself</td><td>false</td></tr><tr><td>MixedListValues</td><td>Supports setting of a {@code List} value. The assumption is that the {@code List} can contain arbitrary serializable values that may or may not be defined as a feature itself. As this{@code List} is &ldquo;mixed&rdquo; it does not need to contain objects of the same type.</td><td>false</td></tr><tr><td>BooleanArrayValues</td><td></td><td>false</td></tr><tr><td>ByteArrayValues</td><td></td><td>true</td></tr><tr><td>DoubleArrayValues</td><td></td><td>false</td></tr><tr><td>FloatArrayValues</td><td></td><td>false</td></tr><tr><td>IntegerArrayValues</td><td></td><td>false</td></tr><tr><td>LongArrayValues</td><td></td><td>false</td></tr><tr><td>SerializableValues</td><td></td><td>false</td></tr><tr><td>StringArrayValues</td><td></td><td>false</td></tr><tr><td>StringValues</td><td></td><td>true</td></tr><tr><td>UniformListValues</td><td>Supports setting of a {@code List} value. The assumption is that the {@code List} can contain arbitrary serializable values that may or may not be defined as a feature itself. As this{@code List} is &ldquo;uniform&rdquo; it must contain objects of the same type.</td><td>false</td></tr></tbody></table><h3 id=gremlin的步骤>Gremlin的步骤</h3><p>HugeGraph支持Gremlin的所有步骤。有关Gremlin的完整参考信息,请参与<a href=http://tinkerpop.apache.org/docs/current/reference/>Gremlin官网</a></p><table><thead><tr><th>步骤</th><th>说明</th><th>文档</th></tr></thead><tbody><tr><td>addE</td><td>在两个顶点之间添加边</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#addedge-step>addE step</a></td></tr><tr><td>addV</td><td>将顶点添加到图形</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#addvertex-step>addV step</a></td></tr><tr><td>and</td><td>确保所有遍历都返回值</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#add-step>and step</a></td></tr><tr><td>as</td><td>用于向步骤的输出分配变量的步骤调制器</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#as-step>as step</a></td></tr><tr><td>by</td><td><code>group</code><code>order</code>配合使用的步骤调制器</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#by-step>by step</a></td></tr><tr><td>coalesce</td><td>返回第一个返回结果的遍历</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#coalesce-step>coalesce step</a></td></tr><tr><td>constant</td><td>返回常量值。 与<code>coalesce</code>配合使用</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#constant-step>constant step</a></td></tr><tr><td>count</td><td>从遍历返回计数</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#addedge-step>count step</a></td></tr><tr><td>dedup</td><td>返回已删除重复内容的值</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#dedup-step>dedup step</a></td></tr><tr><td>drop</td><td>丢弃值(顶点/边缘)</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#drop-step>drop step</a></td></tr><tr><td>fold</td><td>充当用于计算结果聚合值的屏障</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#fold-step>fold step</a></td></tr><tr><td>group</td><td>根据指定的标签将值分组</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#group-step>group step</a></td></tr><tr><td>has</td><td>用于筛选属性、顶点和边缘。 支持<code>hasLabel</code><code>hasId</code><code>hasNot</code><code>has</code> 变体</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#has-step>has step</a></td></tr><tr><td>inject</td><td>将值注入流中</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#inject-step>inject step</a></td></tr><tr><td>is</td><td>用于通过布尔表达式执行筛选器</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#is-step>is step</a></td></tr><tr><td>limit</td><td>用于限制遍历中的项数</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#limit-step>limit step</a></td></tr><tr><td>local</td><td>本地包装遍历的某个部分,类似于子查询</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#local-step>local step</a></td></tr><tr><td>not</td><td>用于生成筛选器的求反结果</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#not-step>not step</a></td></tr><tr><td>optional</td><td>如果生成了某个结果,则返回指定遍历的结果,否则返回调用元素</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#optional-step>optional step</a></td></tr><tr><td>or</td><td>确保至少有一个遍历会返回值</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#or-step>or step</a></td></tr><tr><td>order</td><td>按指定的排序顺序返回结果</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#order-step>order step</a></td></tr><tr><td>path</td><td>返回遍历的完整路径</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#addedge-step>path step</a></td></tr><tr><td>project</td><td>将属性投影为映射</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#project-step>project step</a></td></tr><tr><td>properties</td><td>返回指定标签的属性</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#properties-step>properties step</a></td></tr><tr><td>range</td><td>根据指定的值范围进行筛选</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#range-step>range step</a></td></tr><tr><td>repeat</td><td>将步骤重复指定的次数。 用于循环</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#repeat-step>repeat step</a></td></tr><tr><td>sample</td><td>用于对遍历返回的结果采样</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#sample-step>sample step</a></td></tr><tr><td>select</td><td>用于投影遍历返回的结果</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#select-step>select step</a></td></tr><tr><td>store</td><td>用于遍历返回的非阻塞聚合</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#store-step>store step</a></td></tr><tr><td>tree</td><td>将顶点中的路径聚合到树中</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#tree-step>tree step</a></td></tr><tr><td>unfold</td><td>将迭代器作为步骤展开</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#unfold-step>unfold step</a></td></tr><tr><td>union</td><td>合并多个遍历返回的结果</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#union-step>union step</a></td></tr><tr><td>V</td><td>包括顶点与边之间的遍历所需的步骤:<code>V</code><code>E</code><code>out</code><code>in</code><code>both</code><code>outE</code><code>inE</code><code>bothE</code><code>outV</code><code>inV</code><code>bothV</code><code>otherV</code></td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#vertex-steps>order step</a></td></tr><tr><td>where</td><td>用于筛选遍历返回的结果。 支持 <code>eq</code><code>neq</code><code>lt</code><code>lte</code><code>gt</code><code>gte</code><code>between</code> 运算符</td><td><a href=http://tinkerpop.apache.org/docs/current/reference/#where-step>where step</a></td></tr></tbody></table></div><div class=td-content style=page-break-before:always><h1 id=pg-29164f631ea2ad7e883c0ba00a843508>7.2 - HugeGraph Examples</h1><h3 id=1-概述>1 概述</h3><p>本示例将<a href=http://s3.thinkaurelius.com/docs/titan/1.0.0/getting-started.html>TitanDB Getting Started</a> 为模板来演示HugeGraph的使用方法。通过对比HugeGraph和TitanDB,了解HugeGraph和TitanDB的差异。</p><h4 id=11-hugegraph与titandb的异同>1.1 HugeGraph与TitanDB的异同</h4><p>HugeGraph和TitanDB都是基于<a href=https://tinkerpop.apache.org>Apache TinkerPop3</a>框架的图数据库,均支持<a href=https://tinkerpop.apache.org/gremlin.html>Gremlin</a>图查询语言,在使用方法和接口方面具有很多相似的地方。然而HugeGraph是全新设计开发的,其代码结构清晰,功能较为丰富,接口更为友好等特点。</p><p>HugeGraph相对于TitanDB而言,其主要特点如下:</p><ul><li>HugeGraph目前有HugeGraph-API、HugeGraph-Client、HugeGraph-Loader、HugeGraph-Studio、HugeGraph-Spark等完善的工具组件,可以完成系统集成、数据载入、图可视化查询、Spark 连接等功能;</li><li>HugeGraph具有Server和Client的概念,第三方系统可以通过jar引用、client、api等多种方式接入,而TitanDB仅支持jar引用方式接入。</li><li>HugeGraph的Schema需要显式定义,所有的插入和查询均需要通过严格的schema校验,目前暂不支持schema的隐式创建。</li><li>HugeGraph充分利用后端存储系统的特点来实现数据高效存取,而TitanDB以统一的Kv结构无视后端的差异性。</li><li>HugeGraph的更新操作可以实现按需操作(例如:更新某个属性)性能更好。TitanDB的更新是read and update方式。</li><li>HugeGraph的VertexId和EdgeId均支持拼接,可实现自动去重,同时查询性能更好。TitanDB的所有Id均是自动生成,查询需要经索引。</li></ul><h4 id=12-人物关系图谱>1.2 人物关系图谱</h4><p>本示例通过Property Graph Model图数据模型来描述希腊神话中各人物角色的关系(也被成为人物关系图谱),具体关系详见下图。</p><div style=text-align:center><img src=/docs/images/graph-of-gods.png alt=image></div><p>其中,圆形节点代表实体(Vertex),箭头代表关系(Edge),方框的内容为属性。</p><p>该关系图谱中有两类顶点,分别是人物(character)和位置(location)如下表:</p><table><thead><tr><th>名称</th><th>类型</th><th>属性</th></tr></thead><tbody><tr><td>character</td><td>vertex</td><td>name,age,type</td></tr><tr><td>location</td><td>vertex</td><td>name</td></tr></tbody></table><p>有六种关系,分别是父子(father)、母子(mother)、兄弟(brother)、战斗(battled)、居住(lives)、拥有宠物(pet) 关于关系图谱的具体信息如下:</p><table><thead><tr><th>名称</th><th>类型</th><th>source vertex label</th><th>target vertex label</th><th>属性</th></tr></thead><tbody><tr><td>father</td><td>edge</td><td>character</td><td>character</td><td>-</td></tr><tr><td>mother</td><td>edge</td><td>character</td><td>character</td><td>-</td></tr><tr><td>brother</td><td>edge</td><td>character</td><td>character</td><td>-</td></tr><tr><td>pet</td><td>edge</td><td>character</td><td>character</td><td>-</td></tr><tr><td>lives</td><td>edge</td><td>character</td><td>location</td><td>reason</td></tr></tbody></table><p>在HugeGraph中,每个edge label只能作用于一对source vertex label和target vertex label。也就是说,如果一个图内定义了一种关系father连接character和character,那farther就不能再连接其他的vertex labels。</p><p>因此本例子将原TitanDB中的monster, god, human, demigod均使用相同的<code>vertex label: character</code>来表示, 同时增加属性type来标识人物的类型。<code>edge label</code>与原TitanDB保持一致。当然为了满足<code>edge label</code>约束,也可以通过调整<code>edge label</code><code>name</code>来实现。</p><h3 id=2-graph-schema-and-data-ingest-examples>2 Graph Schema and Data Ingest Examples</h3><p>HugeGraph需要显示创建Schema,因此需要依次创建PropertyKey、VertexLabel、EdgeLabel,如果有需要索引还需要创建IndexLabel。</p><h4 id=21-graph-schema>2.1 Graph Schema</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>schema</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>schema</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;time&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asInt</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>propertyKey</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>asText</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>vertexLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;location&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>primaryKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;father&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;mother&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;battled&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;time&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lives&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;location&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>properties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>nullableKeys</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;pet&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#000>schema</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>edgeLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>link</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>ifNotExist</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>create</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span></code></pre></div><h4 id=22-graph-data>2.2 Graph Data</h4><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// add vertices
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>Vertex</span> <span style=color:#000>saturn</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;saturn&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>10000</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;titan&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>sky</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;location&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;sky&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>sea</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;location&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;sea&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>jupiter</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;jupiter&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>5000</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;god&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>neptune</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;neptune&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>4500</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;god&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>hercules</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hercules&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>30</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;demigod&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>alcmene</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;alcmene&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>45</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;human&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>pluto</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;pluto&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;age&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>4000</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;god&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>nemean</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;nemean&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;monster&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>hydra</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;hydra&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;monster&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>cerberus</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;character&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;cerberus&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;type&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;monster&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>Vertex</span> <span style=color:#000>tartarus</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addVertex</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>T</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>label</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;location&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;name&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;tartarus&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// add edges
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;father&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>saturn</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lives&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>sky</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;loves fresh breezes&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>neptune</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>neptune</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lives&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>sea</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;loves waves&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>neptune</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>neptune</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>hercules</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;father&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>hercules</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;mother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>alcmene</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>hercules</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;battled&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>nemean</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;time&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>1</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>hercules</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;battled&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>hydra</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;time&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>hercules</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;battled&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>cerberus</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;time&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#0000cf;font-weight:700>12</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>jupiter</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;brother&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>neptune</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lives&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>tartarus</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;reason&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#34;no fear of death&#34;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;pet&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>cerberus</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>cerberus</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>addEdge</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;lives&#34;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>tartarus</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><h4 id=23-indices>2.3 Indices</h4><p>HugeGraph默认是自动生成Id,如果用户通过<code>primaryKeys</code>指定<code>VertexLabel</code><code>primaryKeys</code>字段列表后,<code>VertexLabel</code>的Id策略将会自动切换到<code>primaryKeys</code>策略。 启用<code>primaryKeys</code>策略后,HugeGraph通过<code>vertexLabel+primaryKeys</code>拼接生成<code>VertexId</code> ,可实现自动去重,同时无需额外创建索引即可以使用<code>primaryKeys</code>中的属性进行快速查询。 例如 &ldquo;character&rdquo; 和 &ldquo;location&rdquo; 都有<code>primaryKeys("name")</code>属性,因此在不额外创建索引的情况下可以通过<code>g.V().hasLabel('character') .has('name','hercules')</code>查询vertex 。</p><h3 id=3-graph-traversal-examples>3 Graph Traversal Examples</h3><h4 id=31-traversal-query>3.1 Traversal Query</h4><p><strong>1. Find the grandfather of hercules</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;hercules&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;father&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;father&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p>也可以通过<code>repeat</code>方式:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;hercules&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>repeat</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>__</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;father&#39;</span><span style=color:#ce5c00;font-weight:700>)).</span><span style=color:#c4a000>times</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>2</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p><strong>2. Find the name of hercules&rsquo;s father</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;hercules&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;father&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>value</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p><strong>3. Find the characters with age > 100</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;age&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#000>gt</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#0000cf;font-weight:700>100</span><span style=color:#ce5c00;font-weight:700>))</span>
</span></span></code></pre></div><p><strong>4. Find who are pluto&rsquo;s cohabitants</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;pluto&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>in</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>values</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p><strong>5. Find pluto can&rsquo;t be his own cohabitant</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>pluto</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#39;pluto&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>in</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>where</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>is</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>neq</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>)).</span><span style=color:#c4a000>values</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// use &#39;as&#39;
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#39;pluto&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>as</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;x&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>in</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>where</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>neq</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;x&#39;</span><span style=color:#ce5c00;font-weight:700>)).</span><span style=color:#c4a000>values</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p><strong>6. Pluto&rsquo;s Brothers</strong></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-groovy data-lang=groovy><span style=display:flex><span><span style=color:#000>pluto</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>().</span><span style=color:#c4a000>hasLabel</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;character&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>has</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#4e9a06>&#39;pluto&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>next</span><span style=color:#ce5c00;font-weight:700>()</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// where do pluto&#39;s brothers live?
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;brother&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>values</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// which brother lives in which place?
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;brother&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>as</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;god&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>as</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;place&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>select</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;god&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;place&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>// what is the name of the brother and the name of the place?
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span><span style=color:#000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>V</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>pluto</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;brother&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>as</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;god&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>out</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;lives&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>as</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;place&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>select</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;god&#39;</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#4e9a06>&#39;place&#39;</span><span style=color:#ce5c00;font-weight:700>).</span><span style=color:#c4a000>by</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#39;name&#39;</span><span style=color:#ce5c00;font-weight:700>)</span>
</span></span></code></pre></div><p>推荐使用<a href=/docs/quickstart/hugegraph-studio>HugeGraph-Studio</a> 通过可视化的方式来执行上述代码。另外也可以通过HugeGraph-Client、HugeApi、GremlinConsole和GremlinDriver等多种方式执行上述代码。</p><h4 id=32-总结>3.2 总结</h4><p>HugeGraph 目前支持 <code>Gremlin</code> 的语法,用户可以通过 <code>Gremlin / REST-API</code> 实现各种查询需求。</p></div><div class=td-content style=page-break-before:always><h1 id=pg-f0a22a813c843322c0d360d952e434ce>8 - PERFORMANCE</h1></div><div class=td-content><h1 id=pg-63f6d63db3ee3a5270fc1ca0a0c0e181>8.1 - HugeGraph BenchMark Performance</h1><blockquote><p><strong>Note:</strong></p><p>当前的性能指标测试基于很早期的版本。<strong>最新版本</strong>在性能和功能上都有显著的改进。我们鼓励您参考最新的发布版本,
该版本具有<strong>自主分布式存储</strong><strong>增强的计算推下能力</strong>。或者,您可以等待社区更新相关测试数据 (也欢迎反馈共建)。</p></blockquote><h3 id=1-测试环境>1 测试环境</h3><h4 id=11-硬件信息>1.1 硬件信息</h4><table><thead><tr><th>CPU</th><th>Memory</th><th>网卡</th><th>磁盘</th></tr></thead><tbody><tr><td>48 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz</td><td>128G</td><td>10000Mbps</td><td>750GB SSD</td></tr></tbody></table><h4 id=12-软件信息>1.2 软件信息</h4><h5 id=121-测试用例>1.2.1 测试用例</h5><p>测试使用<a href=https://github.com/socialsensor/graphdb-benchmarks>graphdb-benchmark</a>,一个图数据库测试集。该测试集主要包含 4 类测试:</p><ul><li><p>Massive Insertion,批量插入顶点和边,一定数量的顶点或边一次性提交</p></li><li><p>Single Insertion,单条插入,每个顶点或者每条边立即提交</p></li><li><p>Query,主要是图数据库的基本查询操作:</p><ul><li>Find Neighbors,查询所有顶点的邻居</li><li>Find Adjacent Nodes,查询所有边的邻接顶点</li><li>Find Shortest Path,查询第一个顶点到 100 个随机顶点的最短路径</li></ul></li><li><p>Clustering,基于 Louvain Method 的社区发现算法</p></li></ul><h5 id=122-测试数据集>1.2.2 测试数据集</h5><p>测试使用人造数据和真实数据</p><ul><li><p>MIW、SIW 和 QW 使用 SNAP 数据集</p><ul><li><p><a href=http://snap.stanford.edu/data/email-Enron.html>Enron Dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/amazon0601.html>Amazon dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/com-Youtube.html>Youtube dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/com-LiveJournal.html>LiveJournal dataset</a></p></li></ul></li><li><p>CW 使用<a href=https://sites.google.com/site/andrealancichinetti/files>LFR-Benchmark generator</a>生成的人造数据</p></li></ul><h6 id=本测试用到的数据集规模>本测试用到的数据集规模</h6><table><thead><tr><th>名称</th><th>vertex 数目</th><th>edge 数目</th><th>文件大小</th></tr></thead><tbody><tr><td>email-enron.txt</td><td>36,691</td><td>367,661</td><td>4MB</td></tr><tr><td>com-youtube.ungraph.txt</td><td>1,157,806</td><td>2,987,624</td><td>38.7MB</td></tr><tr><td>amazon0601.txt</td><td>403,393</td><td>3,387,388</td><td>47.9MB</td></tr><tr><td>com-lj.ungraph.txt</td><td>3997961</td><td>34681189</td><td>479MB</td></tr></tbody></table><h4 id=13-服务配置>1.3 服务配置</h4><ul><li><p>HugeGraph 版本:0.5.6,RestServer 和 Gremlin Server 和 backends 都在同一台服务器上</p><ul><li>RocksDB 版本:rocksdbjni-5.8.6</li></ul></li><li><p>Titan 版本:0.5.4, 使用 thrift+Cassandra 模式</p><ul><li>Cassandra 版本:cassandra-3.10,commit-log 和 data 共用 SSD</li></ul></li><li><p>Neo4j 版本:2.0.1</p></li></ul><blockquote><p>graphdb-benchmark 适配的 Titan 版本为 0.5.4</p></blockquote><h3 id=2-测试结果>2 测试结果</h3><h4 id=21-batch-插入性能>2.1 Batch 插入性能</h4><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th><th>com-lj.ungraph(3000w)</th></tr></thead><tbody><tr><td>HugeGraph</td><td>0.629</td><td>5.711</td><td>5.243</td><td>67.033</td></tr><tr><td>Titan</td><td>10.15</td><td>108.569</td><td>150.266</td><td>1217.944</td></tr><tr><td>Neo4j</td><td>3.884</td><td>18.938</td><td>24.890</td><td>281.537</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头"()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是批量插入的时间,单位是 s</li><li>例如,HugeGraph 使用 RocksDB 插入 amazon0601 数据集的 300w 条边,花费 5.711s</li></ul><h5 id=结论>结论</h5><ul><li>批量插入性能 HugeGraph(RocksDB) > Neo4j > Titan(thrift+Cassandra)</li></ul><h4 id=22-遍历性能>2.2 遍历性能</h4><h5 id=221-术语说明>2.2.1 术语说明</h5><ul><li>FN(Find Neighbor), 遍历所有 vertex, 根据 vertex 查邻接 edge, 通过 edge 和 vertex 查 other vertex</li><li>FA(Find Adjacent), 遍历所有 edge,根据 edge 获得 source vertex 和 target vertex</li></ul><h5 id=222-fn-性能>2.2.2 FN 性能</h5><table><thead><tr><th>Backend</th><th>email-enron(3.6w)</th><th>amazon0601(40w)</th><th>com-youtube.ungraph(120w)</th><th>com-lj.ungraph(400w)</th></tr></thead><tbody><tr><td>HugeGraph</td><td>4.072</td><td>45.118</td><td>66.006</td><td>609.083</td></tr><tr><td>Titan</td><td>8.084</td><td>92.507</td><td>184.543</td><td>1099.371</td></tr><tr><td>Neo4j</td><td>2.424</td><td>10.537</td><td>11.609</td><td>106.919</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以顶点为单位</li><li>表中数据是遍历顶点花费的时间,单位是 s</li><li>例如,HugeGraph 使用 RocksDB 后端遍历 amazon0601 的所有顶点,并查找邻接边和另一顶点,总共耗时 45.118s</li></ul><h5 id=223-fa-性能>2.2.3 FA 性能</h5><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th><th>com-lj.ungraph(3000w)</th></tr></thead><tbody><tr><td>HugeGraph</td><td>1.540</td><td>10.764</td><td>11.243</td><td>151.271</td></tr><tr><td>Titan</td><td>7.361</td><td>93.344</td><td>169.218</td><td>1085.235</td></tr><tr><td>Neo4j</td><td>1.673</td><td>4.775</td><td>4.284</td><td>40.507</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是遍历边花费的时间,单位是 s</li><li>例如,HugeGraph 使用 RocksDB 后端遍历 amazon0601 的所有边,并查询每条边的两个顶点,总共耗时 10.764s</li></ul><h6 id=结论-1>结论</h6><ul><li>遍历性能 Neo4j > HugeGraph(RocksDB) > Titan(thrift+Cassandra)</li></ul><h4 id=23-hugegraph-图常用分析方法性能>2.3 HugeGraph-图常用分析方法性能</h4><h5 id=术语说明>术语说明</h5><ul><li>FS(Find Shortest Path), 寻找最短路径</li><li>K-neighbor,从起始 vertex 出发,通过 K 跳边能够到达的所有顶点,包括 1, 2, 3&mldr;(K-1), K 跳边可达 vertex</li><li>K-out, 从起始 vertex 出发,恰好经过 K 跳 out 边能够到达的顶点</li></ul><h5 id=fs-性能>FS 性能</h5><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th><th>com-lj.ungraph(3000w)</th></tr></thead><tbody><tr><td>HugeGraph</td><td>0.494</td><td>0.103</td><td>3.364</td><td>8.155</td></tr><tr><td>Titan</td><td>11.818</td><td>0.239</td><td>377.709</td><td>575.678</td></tr><tr><td>Neo4j</td><td>1.719</td><td>1.800</td><td>1.956</td><td>8.530</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是找到<strong>从第一个顶点出发到达随机选择的 100 个顶点的最短路径</strong>的时间,单位是 s</li><li>例如,HugeGraph 使用 RocksDB 后端在图 amazon0601 中查找第一个顶点到 100 个随机顶点的最短路径,总共耗时 0.103s</li></ul><h6 id=结论-2>结论</h6><ul><li>在数据规模小或者顶点关联关系少的场景下,HugeGraph 性能优于 Neo4j 和 Titan</li><li>随着数据规模增大且顶点的关联度增高,HugeGraph 与 Neo4j 性能趋近,都远高于 Titan</li></ul><h5 id=k-neighbor-性能>K-neighbor 性能</h5><table><thead><tr><th>顶点</th><th>深度</th><th>一度</th><th>二度</th><th>三度</th><th>四度</th><th>五度</th><th>六度</th></tr></thead><tbody><tr><td>v1</td><td>时间</td><td>0.031s</td><td>0.033s</td><td>0.048s</td><td>0.500s</td><td>11.27s</td><td>OOM</td></tr><tr><td>v111</td><td>时间</td><td>0.027s</td><td>0.034s</td><td>0.115</td><td>1.36s</td><td>OOM</td><td>&ndash;</td></tr><tr><td>v1111</td><td>时间</td><td>0.039s</td><td>0.027s</td><td>0.052s</td><td>0.511s</td><td>10.96s</td><td>OOM</td></tr></tbody></table><p><em>说明</em></p><ul><li>HugeGraph-Server 的 JVM 内存设置为 32GB,数据量过大时会出现 OOM</li></ul><h5 id=k-out-性能>K-out 性能</h5><table><thead><tr><th>顶点</th><th>深度</th><th>一度</th><th>二度</th><th>三度</th><th>四度</th><th>五度</th><th>六度</th></tr></thead><tbody><tr><td>v1</td><td>时间</td><td>0.054s</td><td>0.057s</td><td>0.109s</td><td>0.526s</td><td>3.77s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>133</td><td>2453</td><td>50,830</td><td>1,128,688</td><td></td><td></td></tr><tr><td>v111</td><td>时间</td><td>0.032s</td><td>0.042s</td><td>0.136s</td><td>1.25s</td><td>20.62s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>211</td><td>4944</td><td>113150</td><td>2,629,970</td><td></td><td></td></tr><tr><td>v1111</td><td>时间</td><td>0.039s</td><td>0.045s</td><td>0.053s</td><td>1.10s</td><td>2.92s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>140</td><td>2555</td><td>50825</td><td>1,070,230</td><td></td><td></td></tr></tbody></table><p><em>说明</em></p><ul><li>HugeGraph-Server 的 JVM 内存设置为 32GB,数据量过大时会出现 OOM</li></ul><h6 id=结论-3>结论</h6><ul><li>FS 场景,HugeGraph 性能优于 Neo4j 和 Titan</li><li>K-neighbor 和 K-out 场景,HugeGraph 能够实现在 5 度范围内秒级返回结果</li></ul><h4 id=24-图综合性能测试-cw>2.4 图综合性能测试-CW</h4><table><thead><tr><th>数据库</th><th>规模 1000</th><th>规模 5000</th><th>规模 10000</th><th>规模 20000</th></tr></thead><tbody><tr><td>HugeGraph(core)</td><td>20.804</td><td>242.099</td><td>744.780</td><td>1700.547</td></tr><tr><td>Titan</td><td>45.790</td><td>820.633</td><td>2652.235</td><td>9568.623</td></tr><tr><td>Neo4j</td><td>5.913</td><td>50.267</td><td>142.354</td><td>460.880</td></tr></tbody></table><p><em>说明</em></p><ul><li>&ldquo;规模"以顶点为单位</li><li>表中数据是社区发现完成需要的时间,单位是 s,例如 HugeGraph 使用 RocksDB 后端在规模 10000 的数据集,社区聚合不再变化,需要耗时 744.780s</li><li>CW 测试是 CRUD 的综合评估</li><li>该测试中 HugeGraph 跟 Titan 一样,没有通过 client,直接对 core 操作</li></ul><h5 id=结论-4>结论</h5><ul><li>社区聚类算法性能 Neo4j > HugeGraph > Titan</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-699ebe5daed825049424b7539aad30f9>8.2 - HugeGraph-API Performance</h1><p>HugeGraph API性能测试主要测试HugeGraph-Server对RESTful API请求的并发处理能力,包括:</p><ul><li>顶点/边的单条插入</li><li>顶点/边的批量插入</li><li>顶点/边的查询</li></ul><p>HugeGraph的每个发布版本的RESTful API的性能测试情况可以参考:</p><ul><li><a href=/docs/performance/api-preformance/hugegraph-api-0.5.6-rocksdb/>v0.5.6 stand-alone</a></li><li><a href=/docs/performance/api-preformance/hugegraph-api-0.5.6-cassandra/>v0.5.6 cluster</a></li></ul><blockquote><p>即将更新,敬请期待!</p></blockquote></div><div class=td-content style=page-break-before:always><h1 id=pg-dbfafc29a5e930415f78f72c47ee67f2>8.2.1 - v0.5.6 Stand-alone(RocksDB)</h1><blockquote><p><strong>Note:</strong></p><p>当前的性能指标测试基于很早期的版本。<strong>最新版本</strong>在性能和功能上都有显著的改进。我们鼓励您参考最新的发布版本,
该版本具有<strong>自主分布式存储</strong><strong>增强的计算推下能力</strong>。或者,您可以等待社区更新相关测试数据 (也欢迎反馈共建)。</p></blockquote><h3 id=1-测试环境>1 测试环境</h3><p>被压机器信息</p><table><thead><tr><th>CPU</th><th>Memory</th><th>网卡</th><th>磁盘</th></tr></thead><tbody><tr><td>48 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz</td><td>128G</td><td>10000Mbps</td><td>750GB SSD,2.7T HDD</td></tr></tbody></table><ul><li>起压力机器信息:与被压机器同配置</li><li>测试工具:apache-Jmeter-2.5.1</li></ul><p>注:起压机器和被压机器在同一机房</p><h3 id=2-测试说明>2 测试说明</h3><h4 id=21-名词定义时间的单位均为-ms>2.1 名词定义(时间的单位均为 ms)</h4><ul><li>Samples &ndash; 本次场景中一共完成了多少个线程</li><li>Average &ndash; 平均响应时间</li><li>Median &ndash; 统计意义上面的响应时间的中值</li><li>90% Line &ndash; 所有线程中 90% 的线程的响应时间都小于 xx</li><li>Min &ndash; 最小响应时间</li><li>Max &ndash; 最大响应时间</li><li>Error &ndash; 出错率</li><li>Throughput &ndash; 吞吐量</li><li>KB/sec &ndash; 以流量做衡量的吞吐量</li></ul><h4 id=22-底层存储>2.2 底层存储</h4><p>后端存储使用 RocksDB,HugeGraph 与 RocksDB 都在同一机器上启动,server 相关的配置文件除主机和端口有修改外,其余均保持默认。</p><h3 id=3-性能结果总结>3 性能结果总结</h3><ol><li>HugeGraph 单条插入顶点和边的速度在每秒 1w 左右</li><li>顶点和边的批量插入速度远大于单条插入速度</li><li>按 id 查询顶点和边的并发度可达到 13000 以上,且请求的平均延时小于 50ms</li></ol><h3 id=4-测试结果及分析>4 测试结果及分析</h3><h4 id=41-batch-插入>4.1 batch 插入</h4><h5 id=411-压力上限测试>4.1.1 压力上限测试</h5><h6 id=测试方法>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数>压力参数</h6><p>持续时间:5min</p><h6 id=顶点的最大插入速度>顶点的最大插入速度:</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/rocksdb/vertex_batch.png alt=image></div><h6 id=结论>结论:</h6><ul><li>并发 2200,顶点的吞吐量是 2026.8,每秒可处理的数据:2026.8*200=405360/s</li></ul><h6 id=边的最大插入速度>边的最大插入速度</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/rocksdb/edge_batch.png alt=image></div><h6 id=结论-1>结论:</h6><ul><li>并发 900,边的吞吐量是 776.9,每秒可处理的数据:776.9*500=388450/s</li></ul><h4 id=42-single-插入>4.2 single 插入</h4><h5 id=421-压力上限测试>4.2.1 压力上限测试</h5><h6 id=测试方法-1>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数-1>压力参数</h6><ul><li>持续时间:5min</li><li>服务异常标志:错误率大于 0.00%</li></ul><h6 id=顶点的单条插入>顶点的单条插入</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/rocksdb/vertex_single.png alt=image></div><h6 id=结论-2>结论:</h6><ul><li>并发 11500,吞吐量为 10730,顶点的单条插入并发能力为 11500</li></ul><h6 id=边的单条插入>边的单条插入</h6><center><img src=/docs/images/API-perf/v0.5.6/rocksdb/edge_single.png alt=image></center><h6 id=结论-3>结论:</h6><ul><li>并发 9000,吞吐量是 8418,边的单条插入并发能力为 9000</li></ul><h4 id=43-按-id-查询>4.3 按 id 查询</h4><h5 id=431-压力上限测试>4.3.1 压力上限测试</h5><h6 id=测试方法-2>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数-2>压力参数</h6><ul><li>持续时间:5min</li><li>服务异常标志:错误率大于 0.00%</li></ul><h6 id=顶点的按-id-查询>顶点的按 id 查询</h6><center><img src=/docs/images/API-perf/v0.5.6/rocksdb/vertex_id_query.png alt=image></center><h6 id=结论-4>结论:</h6><ul><li>并发 14000,吞吐量是 12663,顶点的按 id 查询的并发能力为 14000,平均延时为 44ms</li></ul><h6 id=边的按-id-查询>边的按 id 查询</h6><center><img src=/docs/images/API-perf/v0.5.6/rocksdb/edge_id_query.png alt=image></center><h6 id=结论-5>结论:</h6><ul><li>并发 13000,吞吐量是 12225,边的按 id 查询的并发能力为 13000,平均延时为 12ms</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-fd5b165e28a07f1c35ab177b10e15dc8>8.2.2 - v0.5.6 Cluster(Cassandra)</h1><blockquote><p><strong>Note:</strong></p><p>当前的性能指标测试基于很早期的版本。<strong>最新版本</strong>在性能和功能上都有显著的改进。我们鼓励您参考最新的发布版本,
该版本具有<strong>自主分布式存储</strong><strong>增强的计算推下能力</strong>。或者,您可以等待社区更新相关测试数据 (也欢迎反馈共建)。</p></blockquote><h3 id=1-测试环境>1 测试环境</h3><p>被压机器信息</p><table><thead><tr><th>CPU</th><th>Memory</th><th>网卡</th><th>磁盘</th></tr></thead><tbody><tr><td>48 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz</td><td>128G</td><td>10000Mbps</td><td>750GB SSD,2.7T HDD</td></tr></tbody></table><ul><li>起压力机器信息:与被压机器同配置</li><li>测试工具:apache-Jmeter-2.5.1</li></ul><p>注:起压机器和被压机器在同一机房</p><h3 id=2-测试说明>2 测试说明</h3><h4 id=21-名词定义时间的单位均为-ms>2.1 名词定义(时间的单位均为 ms)</h4><ul><li>Samples &ndash; 本次场景中一共完成了多少个线程</li><li>Average &ndash; 平均响应时间</li><li>Median &ndash; 统计意义上面的响应时间的中值</li><li>90% Line &ndash; 所有线程中 90% 的线程的响应时间都小于 xx</li><li>Min &ndash; 最小响应时间</li><li>Max &ndash; 最大响应时间</li><li>Error &ndash; 出错率</li><li>Throughput &ndash; 吞吐量</li><li>KB/sec &ndash; 以流量做衡量的吞吐量</li></ul><h4 id=22-底层存储>2.2 底层存储</h4><p>后端存储使用 15 节点 Cassandra 集群,HugeGraph 与 Cassandra 集群位于不同的服务器,server 相关的配置文件除主机和端口有修改外,其余均保持默认。</p><h3 id=3-性能结果总结>3 性能结果总结</h3><ol><li>HugeGraph 单条插入顶点和边的速度分别为 9000 和 4500</li><li>顶点和边的批量插入速度分别为5w/s和15w/s,远大于单条插入速度</li><li>按 id 查询顶点和边的并发度可达到 12000 以上,且请求的平均延时小于 70ms</li></ol><h3 id=4-测试结果及分析>4 测试结果及分析</h3><h4 id=41-batch-插入>4.1 batch 插入</h4><h5 id=411-压力上限测试>4.1.1 压力上限测试</h5><h6 id=测试方法>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数>压力参数</h6><p>持续时间:5min</p><h6 id=顶点的最大插入速度>顶点的最大插入速度:</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/vertex_batch.png alt=image></div><h6 id=结论>结论:</h6><ul><li>并发 3500,顶点的吞吐量是 261,每秒可处理的数据:261*200=52200/s</li></ul><h6 id=边的最大插入速度>边的最大插入速度</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/edge_batch.png alt=image></div><h6 id=结论-1>结论:</h6><ul><li>并发 1000,边的吞吐量是 323,每秒可处理的数据:323*500=161500/s</li></ul><h4 id=42-single-插入>4.2 single 插入</h4><h5 id=421-压力上限测试>4.2.1 压力上限测试</h5><h6 id=测试方法-1>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数-1>压力参数</h6><ul><li>持续时间:5min</li><li>服务异常标志:错误率大于 0.00%</li></ul><h6 id=顶点的单条插入>顶点的单条插入</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/vertex_single.png alt=image></div><h6 id=结论-2>结论:</h6><ul><li>并发 9000,吞吐量为 8400,顶点的单条插入并发能力为 9000</li></ul><h6 id=边的单条插入>边的单条插入</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/edge_single.png alt=image></div><h6 id=结论-3>结论:</h6><ul><li>并发 4500,吞吐量是 4160,边的单条插入并发能力为 4500</li></ul><h4 id=43-按-id-查询>4.3 按 id 查询</h4><h5 id=431-压力上限测试>4.3.1 压力上限测试</h5><h6 id=测试方法-2>测试方法</h6><p>不断提升并发量,测试 server 仍能正常提供服务的压力上限</p><h6 id=压力参数-2>压力参数</h6><ul><li>持续时间:5min</li><li>服务异常标志:错误率大于 0.00%</li></ul><h6 id=顶点的按-id-查询>顶点的按 id 查询</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/vertex_id_query.png alt=image></div><h6 id=结论-4>结论:</h6><ul><li>并发 14500,吞吐量是 13576,顶点的按 id 查询的并发能力为 14500,平均延时为 11ms</li></ul><h6 id=边的按-id-查询>边的按 id 查询</h6><div style=text-align:center><img src=/docs/images/API-perf/v0.5.6/cassandra/edge_id_query.png alt=image></div><h6 id=结论-5>结论:</h6><ul><li>并发 12000,吞吐量是 10688,边的按 id 查询的并发能力为 12000,平均延时为 63ms</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-8e73cd18ae7e460700391440de46c404>8.3 - HugeGraph-Loader Performance</h1><blockquote><p><strong>Note:</strong></p><p>当前的性能指标测试基于很早期的版本。<strong>最新版本</strong>在性能和功能上都有显著的改进。我们鼓励您参考最新的发布版本,
该版本具有<strong>自主分布式存储</strong><strong>增强的计算推下能力</strong>。或者,您可以等待社区更新相关测试数据 (也欢迎反馈共建)。</p></blockquote><h2 id=使用场景>使用场景</h2><p>当要批量插入的图数据(包括顶点和边)条数为 billion 级别及以下,或者总数据量小于 TB 时,
可以采用 <a href=/docs/quickstart/hugegraph-loader>HugeGraph-Loader</a> 工具持续、高速导入图数据</p><h2 id=性能>性能</h2><blockquote><p>测试均采用网址数据的边数据</p></blockquote><h3 id=rocksdb-单机性能>RocksDB 单机性能</h3><ul><li>关闭 label index,22.8w edges/s</li><li>开启 label index,15.3w edges/s</li></ul><h3 id=cassandra-集群性能>Cassandra 集群性能</h3><ul><li>默认开启 label index,6.3w edges/s</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-0b6ebbdbce17d47f26fcb874226e5edc>8.4 -</h1><h3 id=1-测试环境>1 测试环境</h3><h4 id=11-硬件信息>1.1 硬件信息</h4><table><thead><tr><th>CPU</th><th>Memory</th><th>网卡</th><th>磁盘</th></tr></thead><tbody><tr><td>48 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz</td><td>128G</td><td>10000Mbps</td><td>750GB SSD</td></tr></tbody></table><h4 id=12-软件信息>1.2 软件信息</h4><h5 id=121-测试用例>1.2.1 测试用例</h5><p>测试使用<a href=https://github.com/socialsensor/graphdb-benchmarks>graphdb-benchmark</a>,一个图数据库测试集。该测试集主要包含4类测试:</p><ul><li><p>Massive Insertion,批量插入顶点和边,一定数量的顶点或边一次性提交</p></li><li><p>Single Insertion,单条插入,每个顶点或者每条边立即提交</p></li><li><p>Query,主要是图数据库的基本查询操作:</p><ul><li>Find Neighbors,查询所有顶点的邻居</li><li>Find Adjacent Nodes,查询所有边的邻接顶点</li><li>Find Shortest Path,查询第一个顶点到100个随机顶点的最短路径</li></ul></li><li><p>Clustering,基于Louvain Method的社区发现算法</p></li></ul><h5 id=122-测试数据集>1.2.2 测试数据集</h5><p>测试使用人造数据和真实数据</p><ul><li><p>MIW、SIW和QW使用SNAP数据集</p><ul><li><p><a href=http://snap.stanford.edu/data/email-Enron.html>Enron Dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/amazon0601.html>Amazon dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/com-Youtube.html>Youtube dataset</a></p></li><li><p><a href=http://snap.stanford.edu/data/com-LiveJournal.html>LiveJournal dataset</a></p></li></ul></li><li><p>CW使用<a href=https://sites.google.com/site/andrealancichinetti/files>LFR-Benchmark generator</a>生成的人造数据</p></li></ul><h6 id=本测试用到的数据集规模>本测试用到的数据集规模</h6><table><thead><tr><th>名称</th><th>vertex数目</th><th>edge数目</th><th>文件大小</th></tr></thead><tbody><tr><td>email-enron.txt</td><td>36,691</td><td>367,661</td><td>4MB</td></tr><tr><td>com-youtube.ungraph.txt</td><td>1,157,806</td><td>2,987,624</td><td>38.7MB</td></tr><tr><td>amazon0601.txt</td><td>403,393</td><td>3,387,388</td><td>47.9MB</td></tr></tbody></table><h4 id=13-服务配置>1.3 服务配置</h4><ul><li>HugeGraph版本:0.4.4,RestServer和Gremlin Server和backends都在同一台服务器上</li><li>Cassandra版本:cassandra-3.10,commit-log 和data共用SSD</li><li>RocksDB版本:rocksdbjni-5.8.6</li><li>Titan版本:0.5.4, 使用thrift+Cassandra模式</li></ul><blockquote><p>graphdb-benchmark适配的Titan版本为0.5.4</p></blockquote><h3 id=2-测试结果>2 测试结果</h3><h4 id=21-batch插入性能>2.1 Batch插入性能</h4><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th></tr></thead><tbody><tr><td>Titan</td><td>9.516</td><td>88.123</td><td>111.586</td></tr><tr><td>RocksDB</td><td>2.345</td><td>14.076</td><td>16.636</td></tr><tr><td>Cassandra</td><td>11.930</td><td>108.709</td><td>101.959</td></tr><tr><td>Memory</td><td>3.077</td><td>15.204</td><td>13.841</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头"()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是批量插入的时间,单位是s</li><li>例如,HugeGraph使用RocksDB插入amazon0601数据集的300w条边,花费14.076s,速度约为21w edges/s</li></ul><h5 id=结论>结论</h5><ul><li>RocksDB和Memory后端插入性能优于Cassandra</li><li>HugeGraph和Titan同样使用Cassandra作为后端的情况下,插入性能接近</li></ul><h4 id=22-遍历性能>2.2 遍历性能</h4><h5 id=221-术语说明>2.2.1 术语说明</h5><ul><li>FN(Find Neighbor), 遍历所有vertex, 根据vertex查邻接edge, 通过edge和vertex查other vertex</li><li>FA(Find Adjacent), 遍历所有edge,根据edge获得source vertex和target vertex</li></ul><h5 id=222-fn性能>2.2.2 FN性能</h5><table><thead><tr><th>Backend</th><th>email-enron(3.6w)</th><th>amazon0601(40w)</th><th>com-youtube.ungraph(120w)</th></tr></thead><tbody><tr><td>Titan</td><td>7.724</td><td>70.935</td><td>128.884</td></tr><tr><td>RocksDB</td><td>8.876</td><td>65.852</td><td>63.388</td></tr><tr><td>Cassandra</td><td>13.125</td><td>126.959</td><td>102.580</td></tr><tr><td>Memory</td><td>22.309</td><td>207.411</td><td>165.609</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以顶点为单位</li><li>表中数据是遍历顶点花费的时间,单位是s</li><li>例如,HugeGraph使用RocksDB后端遍历amazon0601的所有顶点,并查找邻接边和另一顶点,总共耗时65.852s</li></ul><h5 id=223-fa性能>2.2.3 FA性能</h5><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th></tr></thead><tbody><tr><td>Titan</td><td>7.119</td><td>63.353</td><td>115.633</td></tr><tr><td>RocksDB</td><td>6.032</td><td>64.526</td><td>52.721</td></tr><tr><td>Cassandra</td><td>9.410</td><td>102.766</td><td>94.197</td></tr><tr><td>Memory</td><td>12.340</td><td>195.444</td><td>140.89</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是遍历边花费的时间,单位是s</li><li>例如,HugeGraph使用RocksDB后端遍历amazon0601的所有边,并查询每条边的两个顶点,总共耗时64.526s</li></ul><h6 id=结论-1>结论</h6><ul><li>HugeGraph RocksDB > Titan thrift+Cassandra > HugeGraph Cassandra > HugeGraph Memory</li></ul><h4 id=23-hugegraph-图常用分析方法性能>2.3 HugeGraph-图常用分析方法性能</h4><h5 id=术语说明>术语说明</h5><ul><li>FS(Find Shortest Path), 寻找最短路径</li><li>K-neighbor,从起始vertex出发,通过K跳边能够到达的所有顶点, 包括1, 2, 3&mldr;(K-1), K跳边可达vertex</li><li>K-out, 从起始vertex出发,恰好经过K跳out边能够到达的顶点</li></ul><h5 id=fs性能>FS性能</h5><table><thead><tr><th>Backend</th><th>email-enron(30w)</th><th>amazon0601(300w)</th><th>com-youtube.ungraph(300w)</th></tr></thead><tbody><tr><td>Titan</td><td>11.333</td><td>0.313</td><td>376.06</td></tr><tr><td>RocksDB</td><td>44.391</td><td>2.221</td><td>268.792</td></tr><tr><td>Cassandra</td><td>39.845</td><td>3.337</td><td>331.113</td></tr><tr><td>Memory</td><td>35.638</td><td>2.059</td><td>388.987</td></tr></tbody></table><p><em>说明</em></p><ul><li>表头&rdquo;()&ldquo;中数据是数据规模,以边为单位</li><li>表中数据是找到<strong>从第一个顶点出发到达随机选择的100个顶点的最短路径</strong>的时间,单位是s</li><li>例如,HugeGraph使用RocksDB查找第一个顶点到100个随机顶点的最短路径,总共耗时2.059s</li></ul><h6 id=结论-2>结论</h6><ul><li>在数据规模小或者顶点关联关系少的场景下,Titan最短路径性能优于HugeGraph</li><li>随着数据规模增大且顶点的关联度增高,HugeGraph最短路径性能优于Titan</li></ul><h5 id=k-neighbor性能>K-neighbor性能</h5><table><thead><tr><th>顶点</th><th>深度</th><th>一度</th><th>二度</th><th>三度</th><th>四度</th><th>五度</th><th>六度</th></tr></thead><tbody><tr><td>v1</td><td>时间</td><td>0.031s</td><td>0.033s</td><td>0.048s</td><td>0.500s</td><td>11.27s</td><td>OOM</td></tr><tr><td>v111</td><td>时间</td><td>0.027s</td><td>0.034s</td><td>0.115</td><td>1.36s</td><td>OOM</td><td>&ndash;</td></tr><tr><td>v1111</td><td>时间</td><td>0.039s</td><td>0.027s</td><td>0.052s</td><td>0.511s</td><td>10.96s</td><td>OOM</td></tr></tbody></table><p><em>说明</em></p><ul><li>HugeGraph-Server的JVM内存设置为32GB,数据量过大时会出现OOM</li></ul><h5 id=k-out性能>K-out性能</h5><table><thead><tr><th>顶点</th><th>深度</th><th>一度</th><th>二度</th><th>三度</th><th>四度</th><th>五度</th><th>六度</th></tr></thead><tbody><tr><td>v1</td><td>时间</td><td>0.054s</td><td>0.057s</td><td>0.109s</td><td>0.526s</td><td>3.77s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>133</td><td>2453</td><td>50,830</td><td>1,128,688</td><td></td><td></td></tr><tr><td>v111</td><td>时间</td><td>0.032s</td><td>0.042s</td><td>0.136s</td><td>1.25s</td><td>20.62s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>211</td><td>4944</td><td>113150</td><td>2,629,970</td><td></td><td></td></tr><tr><td>v1111</td><td>时间</td><td>0.039s</td><td>0.045s</td><td>0.053s</td><td>1.10s</td><td>2.92s</td><td>OOM</td></tr><tr><td></td><td>10</td><td>140</td><td>2555</td><td>50825</td><td>1,070,230</td><td></td><td></td></tr></tbody></table><p><em>说明</em></p><ul><li>HugeGraph-Server的JVM内存设置为32GB,数据量过大时会出现OOM</li></ul><h6 id=结论-3>结论</h6><ul><li>FS场景,HugeGraph性能优于Titan</li><li>K-neighbor和K-out场景,HugeGraph能够实现在5度范围内秒级返回结果</li></ul><h4 id=24-图综合性能测试-cw>2.4 图综合性能测试-CW</h4><table><thead><tr><th>数据库</th><th>规模1000</th><th>规模5000</th><th>规模10000</th><th>规模20000</th></tr></thead><tbody><tr><td>Titan</td><td>45.943</td><td>849.168</td><td>2737.117</td><td>9791.46</td></tr><tr><td>Memory(core)</td><td>41.077</td><td>1825.905</td><td>*</td><td>*</td></tr><tr><td>Cassandra(core)</td><td>39.783</td><td>862.744</td><td>2423.136</td><td>6564.191</td></tr><tr><td>RocksDB(core)</td><td>33.383</td><td>199.894</td><td>763.869</td><td>1677.813</td></tr></tbody></table><p><em>说明</em></p><ul><li>&ldquo;规模"以顶点为单位</li><li>表中数据是社区发现完成需要的时间,单位是s,例如HugeGraph使用RocksDB后端在规模10000的数据集,社区聚合不再变化,需要耗时763.869s</li><li>&ldquo;*&ldquo;表示超过10000s未完成</li><li>CW测试是CRUD的综合评估</li><li>后三者分别是HugeGraph的不同后端,该测试中HugeGraph跟Titan一样,没有通过client,直接对core操作</li></ul><h5 id=结论-4>结论</h5><ul><li>HugeGraph在使用Cassandra后端时,性能略优于Titan,随着数据规模的增大,优势越来越明显,数据规模20000时,比Titan快30%</li><li>HugeGraph在使用RocksDB后端时,性能远高于Titan和HugeGraph的Cassandra后端,分别比两者快了6倍和4倍</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-99a93ef9534d11fef4be3e4b3b1a6381>9 - Contribution Guidelines</h1></div><div class=td-content><h1 id=pg-17ea1d6a1e6627d08a7d6f4d2898cca1>9.1 - 如何参与 HugeGraph 社区</h1><blockquote><p>TODO: translate this article to Chinese</p></blockquote><p>Thanks for taking the time to contribute! As an open source project, HugeGraph is looking forward to be contributed from everyone, and we are also grateful to all the contributors.</p><p>The following is a contribution guide for HugeGraph:</p><img width=884 alt=image src=https://user-images.githubusercontent.com/9625821/159643158-8bf72c0a-93c3-4a58-8912-7b2ab20ced1d.png><h2 id=1-preparation>1. Preparation</h2><p><strong>建议</strong>: 使用 <a href=https://desktop.github.com/>GitHub desktop</a> 可以大幅简化和改善你提交 PR/Commit 的过程, 特别适合新人</p><p>We can contribute by reporting issues, submitting code patches or any other feedback.</p><p>Before submitting the code, we need to do some preparation:</p><ol><li><p>Sign up or login to GitHub: <a href=https://github.com>https://github.com</a></p></li><li><p>Fork HugeGraph repo from GitHub: <a href=https://github.com/apache/hugegraph/fork>https://github.com/apache/incubator-hugegraph/fork</a></p></li><li><p>Clone code from fork repo to local: <a href=https://github.com/$%7BGITHUB_USER_NAME%7D/hugegraph>https://github.com/${GITHUB_USER_NAME}/hugegraph</a></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># clone code from remote to local repo</span>
</span></span><span style=display:flex><span>git clone https://github.com/<span style=color:#4e9a06>${</span><span style=color:#000>GITHUB_USER_NAME</span><span style=color:#4e9a06>}</span>/hugegraph
</span></span></code></pre></div></li><li><p>Configure local HugeGraph repo</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#204a87>cd</span> hugegraph
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># add upstream to synchronize the latest code</span>
</span></span><span style=display:flex><span>git remote add hugegraph https://github.com/apache/hugegraph
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># set name and email to push code to github</span>
</span></span><span style=display:flex><span>git config user.name <span style=color:#4e9a06>&#34;{full-name}&#34;</span> <span style=color:#8f5902;font-style:italic># like &#34;Jermy Li&#34;</span>
</span></span><span style=display:flex><span>git config user.email <span style=color:#4e9a06>&#34;{email-address-of-github}&#34;</span> <span style=color:#8f5902;font-style:italic># like &#34;jermy@apache.org&#34;</span>
</span></span></code></pre></div></li></ol><h2 id=2-create-an-issue-on-github>2. Create an Issue on GitHub</h2><p>If you encounter bugs or have any questions, please go to <a href=https://github.com/apache/incubator-hugegraph/issues>GitHub Issues</a> to report them and feel free to <a href=https://github.com/apache/hugegraph/issues/new>create an issue</a>.</p><h2 id=3-make-changes-of-code-locally>3. Make changes of code locally</h2><h4 id=31-create-a-new-branch>3.1 Create a new branch</h4><p>Please don&rsquo;t use master branch for development. We should create a new branch instead:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># checkout master branch</span>
</span></span><span style=display:flex><span>git checkout master
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># pull the latest code from official hugegraph</span>
</span></span><span style=display:flex><span>git pull hugegraph
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># create new branch: bugfix-branch</span>
</span></span><span style=display:flex><span>git checkout -b bugfix-branch
</span></span></code></pre></div><h4 id=32-change-the-code>3.2 Change the code</h4><p>Assume that we need to modify some files like &ldquo;HugeGraph.java&rdquo; and &ldquo;HugeFactory.java&rdquo;:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># modify code to fix a bug</span>
</span></span><span style=display:flex><span>vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
</span></span><span style=display:flex><span>vim hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># run test locally (optional)</span>
</span></span><span style=display:flex><span>mvn <span style=color:#204a87>test</span> -Pcore-test,memory
</span></span></code></pre></div><p>Note: In order to be consistent with the code style easily, if you use <a href=https://www.jetbrains.com/idea/>IDEA</a> as your IDE, you can directly <a href=https://www.jetbrains.com/help/idea/configuring-code-style.html>import</a> our code style <a href=./hugegraph-style.xml>configuration file</a>.</p><h5 id=321-添加第三方依赖>3.2.1 添加第三方依赖</h5><p>如果我们要在 <code>HugeGraph</code> 项目中添加新的第三方依赖, 我们需要做下面的几件事情:</p><ol><li>找到第三方依赖的仓库,将依赖的 <code>license</code> 文件放到 <a href=https://github.com/apache/incubator-hugegraph/tree/master/hugegraph-server/hugegraph-dist/release-docs/licenses>./hugegraph-dist/release-docs/licenses/</a> 路径下。</li><li><a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/LICENSE>./hugegraph-dist/release-docs/LICENSE</a> 中声明该依赖的 <code>LICENSE</code> 信息。</li><li>找到仓库里的 NOTICE 文件,将其追加到 <a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/release-docs/NOTICE>./hugegraph-dist/release-docs/NOTICE</a> 文件后面(如果没有NOTICE文件则跳过这一步)。</li><li>本地执行<a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh>./hugegraph-dist/scripts/dependency/regenerate_known_dependencies.sh</a> 脚本来更新依赖列表<a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/scripts/dependency/known-dependencies.txt>known-dependencies.txt</a> (或者手动更新)。</li></ol><p><strong>例如</strong>:在项目中引入了第三方新依赖 -> <code>ant-1.9.1.jar</code></p><ul><li>项目源码位于:https://github.com/apache/ant/tree/rel/1.9.1</li><li>LICENSE 文件:https://github.com/apache/ant/blob/rel/1.9.1/LICENSE</li><li>NOTICE 文件:https://github.com/apache/ant/blob/rel/1.9.1/NOTICE</li></ul><p><code>ant-1.9.1.jar</code> 的 license 信息需要在 LICENSE 文件中指定,notice 信息需要在 NOTICE 文件中指定。 ant-1.9.1.jar 对应的详细 LICENSE 文件需要复制到我们的 licenses/ 目录下。最后更新 known-dependencies.txt 文件。</p><h4 id=33-commit-changes-to-git-repo>3.3 Commit changes to git repo</h4><p>After the code has been completed, we submit them to the local git repo:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># add files to local git index</span>
</span></span><span style=display:flex><span>git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeGraph.java
</span></span><span style=display:flex><span>git add hugegraph-core/src/main/java/org/apache/hugegraph/HugeFactory.java
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># commit to local git repo</span>
</span></span><span style=display:flex><span>git commit
</span></span></code></pre></div><p>Please edit the commit message after running <code>git commit</code>, we can explain what and how to fix a bug or implement a feature, the following is an example:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-sh data-lang=sh><span style=display:flex><span>Fix bug: run deploy multiple <span style=color:#204a87>times</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>fix <span style=color:#8f5902;font-style:italic>#ISSUE_ID</span>
</span></span></code></pre></div><blockquote><p>Please remember to fill in the issue id, which was generated by GitHub after issue creation.</p></blockquote><h4 id=34-push-commit-to-github-fork-repo>3.4 Push commit to GitHub fork repo</h4><p>Push the local commit to GitHub fork repo:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># push the local commit to fork repo</span>
</span></span><span style=display:flex><span>git push origin bugfix-branch:bugfix-branch
</span></span></code></pre></div><p>Note that since GitHub requires submitting code through <code>username + token</code> (instead of using <code>username + password</code> directly), you need to create a GitHub token from <a href=https://github.com/settings/tokens>https://github.com/settings/tokens</a>:
<img width=1280 alt=image src=https://user-images.githubusercontent.com/9625821/163524204-7fe0e6bf-9c8b-4b1a-ac65-6a0ac423eb16.png></p><h2 id=4-create-a-pull-request>4. Create a Pull Request</h2><p>Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button &ldquo;Compare & pull request&rdquo; to do it. Then edit the description for proposed changes, which can just be copied from the commit message.</p><p>Note: please make sure the email address you used to submit the code is bound to the GitHub account. For how to bind the email address, please refer to <a href=https://github.com/settings/emails>https://github.com/settings/emails</a>:
<img width=1280 alt=image src=https://user-images.githubusercontent.com/9625821/163522445-2a50a72a-dea2-434f-9868-3a0d40d0d037.png></p><h2 id=5-code-review>5. Code review</h2><p>Maintainers will start the code review after all the <strong>automatic</strong> checks are passed:</p><ul><li>Check: Contributor License Agreement is signed</li><li>Check: Travis CI builds is passed (automatically Test and Deploy)</li></ul><p>The commit will be accepted and merged if there is no problem after review.</p><p>Please click on &ldquo;Details&rdquo; to find the problem if any check does not pass.</p><p>If there are checks not passed or changes requested, then continue to modify the code and push again.</p><h2 id=6-more-changes-after-review>6. More changes after review</h2><p>If we have not passed the review, don&rsquo;t be discouraged. Usually a commit needs to be reviewed several times before being accepted! Please follow the review comments and make further changes.</p><p>After the further changes, we submit them to the local repo:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># commit all updated files in a new commit,</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># please feel free to enter any appropriate commit message, note that</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># we will squash all commits in the pull request as one commit when</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># merging into the master branch.</span>
</span></span><span style=display:flex><span>git commit -a
</span></span></code></pre></div><blockquote><p>If there are conflicts that prevent the code from being merged, we need to rebase on master branch:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># synchronize the latest code</span>
</span></span><span style=display:flex><span>git checkout master
</span></span><span style=display:flex><span>git pull hugegraph
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># rebase on master</span>
</span></span><span style=display:flex><span>git checkout bugfix-branch
</span></span><span style=display:flex><span>git rebase -i master
</span></span></code></pre></div></blockquote><p>And push it to GitHub fork repo again:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-shell data-lang=shell><span style=display:flex><span><span style=color:#8f5902;font-style:italic># force push the local commit to fork repo</span>
</span></span><span style=display:flex><span>git push -f origin bugfix-branch:bugfix-branch
</span></span></code></pre></div><p>GitHub will automatically update the Pull Request after we push it, just wait for code review.</p></div><div class=td-content style=page-break-before:always><h1 id=pg-dc89ef117bed0b0ef3c6487f9a6a8bd0>9.2 - 订阅社区邮箱</h1><p>按照以下步骤订阅邮件列表:</p><ul><li>通过您的电子邮件账户发送邮件至 <a href=mailto:dev-subscribe@hugegraph.apache.org>dev-subscribe@hugegraph.apache.org</a>,然后您将收到一封确认邮件。</li><li>回复确认邮件以确认您的订阅。然后,您将收到另一封确认邮件。</li><li>现在您已经成为该邮件列表的订阅者。如果您有更多问题,只需发送邮件到邮件列表,社区同学看到后会及时回复。</li></ul><p>您可以随时订阅邮件列表。此外,您也可以直接浏览<a href=https://lists.apache.org/list.html?dev@hugegraph.apache.org>历史邮件/所有邮件</a>(即使没有订阅列表)。</p><p>注意事项:</p><ul><li>如果您没有收到确认邮件,请在24小时后再重试发送邮件。</li><li>在成功订阅邮件列表之前,请勿发送电子邮件到 <strong>dev</strong>(未订阅发送的邮件将被自动拦截)。</li></ul><p>HugeGraph提供了一个供开发和用户讨论的电子邮件列表。</p><ul><li>hugegraph-dev: <a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a> 用于开发和用户讨论。</li></ul><p>有关邮件订阅的更多信息,请参阅:</p><ul><li><a href=https://lists.apache.org/list.html?dev@hugegraph.apache.org>https://lists.apache.org/list.html?dev@hugegraph.apache.org</a></li><li><a href=http://apache.org/foundation/mailinglists.html#subscribing>http://apache.org/foundation/mailinglists.html#subscribing</a></li></ul><h1 id=退订邮件列表>退订邮件列表</h1><p>如果您不再需要了解 HugeGraph 的最新动态,可以退订邮件列表。</p><p>退订邮件列表的步骤如下:</p><ol><li><p>使用您订阅时的电子邮件发送邮件到 <a href=mailto:dev-unsubscribe@hugegraph.apache.org>dev-unsubscribe@hugegraph.apache.org</a>(主题和内容任意)。</p></li><li><p>收到确认邮件并回复。完成第一步后,您将收到来自 <a href=mailto:dev-help@hugegraph.apache.org>dev-help@hugegraph.apache.org</a> 的确认邮件(如果未收到,请确认邮件是否被自动归类为垃圾邮件、推广邮件、订阅邮件等)。然后直接回复邮件,或点击邮件中的链接快速回复(主题和内容任意)。</p></li><li><p>收到再见邮件。完成上述步骤后,您将收到一封主题为 &ldquo;GOODBYE from <a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a>&rdquo; 的再见邮件,表示您已成功退订 Apache HugeGraph 邮件列表,您将不再接收来自 <a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a> 的邮件。</p></li></ol></div><div class=td-content style=page-break-before:always><h1 id=pg-07536ba8fd0a4ba5975f821978cf0009>9.3 - 验证 Apache 发版</h1><blockquote><p>Note: 这篇文档会持续更新。
建议使用 Java11 验证测试,从 1.5.0 版本开始(除 client 外) 不再支持 Java8</p></blockquote><h2 id=验证阶段>验证阶段</h2><p>当内部的临时发布和打包工作完成后,其他的社区开发者 (尤其是 PMC)
需要参与到<a href=https://cwiki.apache.org/confluence/display/INCUBATOR/Incubator+Release+Checklist>验证环节</a>
确保某个人发布版本的"正确性 + 完整性", 这里需要<strong>每个人</strong>都尽量参与,然后后序<strong>邮件回复</strong>的时候说明自己
<strong>已检查</strong>了哪些项。(下面是核心项)</p><h4 id=1-准备工作>1. 准备工作</h4><p>如果本地没有 svn 或 gpg 或 wget 环境,建议先安装一下 (windows 推荐使用 WSL2 环境,
或者至少是 <code>git-bash</code>), 同时确保安装 Java(推荐 11) 和 maven 软件。</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 1. 安装svn</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># ubuntu/debian</span>
</span></span><span style=display:flex><span>sudo apt install subversion -y
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># MacOS</span>
</span></span><span style=display:flex><span>brew install subversion
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 验证安装是否成功, 执行以下命令:</span>
</span></span><span style=display:flex><span>svn --version
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 2. 安装gpg</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># ubuntu/debian</span>
</span></span><span style=display:flex><span>sudo apt-get install gnupg -y
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># MacOS</span>
</span></span><span style=display:flex><span>brew install gnupg
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 验证安装是否成功, 执行以下命令:</span>
</span></span><span style=display:flex><span>gpg --version
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 3. 安装wget</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># ubuntu/debian</span>
</span></span><span style=display:flex><span>sudo apt-get install wget -y
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># MacOS</span>
</span></span><span style=display:flex><span>brew install wget
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 4. 下载 hugegraph-svn 目录 (版本号注意填写此次验证版本)</span>
</span></span><span style=display:flex><span>svn co https://dist.apache.org/repos/dist/dev/incubator/hugegraph/1.x.x/
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># (注) 如果出现 svn 下载某个文件速度很慢的情况, 可以考虑 wget 单个文件下载, 如下 (或考虑使用 VPN / 代理)</span>
</span></span><span style=display:flex><span>wget https://dist.apache.org/repos/dist/dev/incubator/hugegraph/1.x.x/apache-hugegraph-toolchain-incubating-1.x.x.tar.gz
</span></span></code></pre></div><h4 id=2-检查-hash-值>2. 检查 hash 值</h4><p>首先需要检查 <code>source + binary</code> 包的文件完整性,通过 <code>shasum</code> 进行校验,确保和发布到 apache/github 上的
hash 值一致 (一般是 sha512)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>执行命令:
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>for</span> i in *.tar.gz<span style=color:#000;font-weight:700>;</span> <span style=color:#204a87;font-weight:700>do</span> <span style=color:#204a87>echo</span> <span style=color:#000>$i</span><span style=color:#000;font-weight:700>;</span> shasum -a <span style=color:#0000cf;font-weight:700>512</span> --check <span style=color:#000>$i</span>.sha512<span style=color:#000;font-weight:700>;</span> <span style=color:#204a87;font-weight:700>done</span>
</span></span></code></pre></div><h4 id=3-检查-gpg-签名>3. 检查 gpg 签名</h4><p>这个就是为了确保发布的包是由<strong>可信赖</strong>的人上传的,假设 tom 签名后上传,其他人应该下载 A 的<strong>公钥</strong>
然后进行<strong>签名确认</strong>, 相关命令:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 1. 下载项目可信赖公钥到本地 (首次需要) &amp; 导入</span>
</span></span><span style=display:flex><span>curl https://downloads.apache.org/incubator/hugegraph/KEYS &gt; KEYS
</span></span><span style=display:flex><span>gpg --import KEYS
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 导入后可以看到如下输出, 这代表导入了 x 个用户公钥</span>
</span></span><span style=display:flex><span>gpg: /home/ubuntu/.gnupg/trustdb.gpg: trustdb created
</span></span><span style=display:flex><span>gpg: key BA7E78F8A81A885E: public key <span style=color:#4e9a06>&#34;imbajin (apache mail) &lt;jin@apache.org&gt;&#34;</span> imported
</span></span><span style=display:flex><span>gpg: key 818108E7924549CC: public key <span style=color:#4e9a06>&#34;vaughn &lt;vaughn@apache.org&gt;&#34;</span> imported
</span></span><span style=display:flex><span>gpg: key 28DCAED849C4180E: public key <span style=color:#4e9a06>&#34;coderzc (CODE SIGNING KEY) &lt;zhaocong@apache.org&gt;&#34;</span> imported
</span></span><span style=display:flex><span>....
</span></span><span style=display:flex><span>gpg: Total number processed: x
</span></span><span style=display:flex><span>gpg: imported: x
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 2. 信任发版用户 (你需要信任 n 个邮件里提到的 gpg 用户名, >1则依次执行相同操作)</span>
</span></span><span style=display:flex><span>gpg --edit-key <span style=color:#000>$USER</span> <span style=color:#8f5902;font-style:italic># 这里填写具体用户名或者公钥串, 回车进入交互模式</span>
</span></span><span style=display:flex><span>gpg&gt; trust
</span></span><span style=display:flex><span>...输出选项..
</span></span><span style=display:flex><span>Your decision? <span style=color:#0000cf;font-weight:700>5</span> <span style=color:#8f5902;font-style:italic># 选择5</span>
</span></span><span style=display:flex><span>Do you really want to <span style=color:#204a87>set</span> this key to ultimate trust? <span style=color:#ce5c00;font-weight:700>(</span>y/N<span style=color:#ce5c00;font-weight:700>)</span> y <span style=color:#8f5902;font-style:italic># 选择y, 然后 q 退出信任下一个用户</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># (可选) 你也可以直接使用非交互模式的如下命令:</span>
</span></span><span style=display:flex><span><span style=color:#204a87>echo</span> -e <span style=color:#4e9a06>&#34;5\ny\n&#34;</span> <span style=color:#000;font-weight:700>|</span> gpg --batch --command-fd <span style=color:#0000cf;font-weight:700>0</span> --edit-key <span style=color:#000>$USER</span> trust
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 或者是信任所有当前导入过的 gpg 公钥 (请小心检查)</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>for</span> key in <span style=color:#204a87;font-weight:700>$(</span>gpg --no-tty --list-keys --with-colons <span style=color:#000;font-weight:700>|</span> awk -F: <span style=color:#4e9a06>&#39;/^pub/ {print $5}&#39;</span><span style=color:#204a87;font-weight:700>)</span><span style=color:#000;font-weight:700>;</span> <span style=color:#204a87;font-weight:700>do</span>
</span></span><span style=display:flex><span> <span style=color:#204a87>echo</span> -e <span style=color:#4e9a06>&#34;5\ny\n&#34;</span> <span style=color:#000;font-weight:700>|</span> gpg --batch --command-fd <span style=color:#0000cf;font-weight:700>0</span> --edit-key <span style=color:#4e9a06>&#34;</span><span style=color:#000>$key</span><span style=color:#4e9a06>&#34;</span> trust
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>done</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 3. 检查签名(确保没有 Warning 输出, 每一个 source/binary 文件都提示 Good Signature)</span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic>#单个文件验证</span>
</span></span><span style=display:flex><span>gpg --verify xx.asc xxx-src.tar.gz
</span></span><span style=display:flex><span>gpg --verify xx.asc xxx.tar.gz <span style=color:#8f5902;font-style:italic># 注:目前没有 bin/binary 后缀</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 一行脚本快速验证所有包 (推荐使用,请确保所有 gpg 公钥已经信任)</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>for</span> i in *.tar.gz<span style=color:#000;font-weight:700>;</span> <span style=color:#204a87;font-weight:700>do</span> <span style=color:#204a87>echo</span> <span style=color:#000>$i</span><span style=color:#000;font-weight:700>;</span> gpg --verify <span style=color:#000>$i</span>.asc <span style=color:#000>$i</span> <span style=color:#000;font-weight:700>;</span> <span style=color:#204a87;font-weight:700>done</span>
</span></span></code></pre></div><p>先确认了整体的"完整性 + 一致性", 然后接下来确认具体的内容 (<strong>关键</strong>)</p><h4 id=4-检查压缩包内容>4. 检查压缩包内容</h4><p>这里检查准备工作下载的压缩包内容。分源码包 + 二进制包两个方面,源码包更为严格,挑核心的部分说
(完整的列表可参考官方 <a href=https://cwiki.apache.org/confluence/display/INCUBATOR/Incubator+Release+Checklist>Wiki</a>, 比较长)</p><h5 id=a-源码包>A. 源码包</h5><p>解压 <code>*hugegraph*src.tar.gz</code>后,进行如下检查:</p><ol><li>文件夹都带有 <code>incubating</code>, 且不存在<strong>空的</strong>文件/文件夹</li><li>存在 <code>LICENSE</code> + <code>NOTICE</code> + 存在 <code>DISCLAIMER</code> 文件并且内容正常</li><li><strong>不存在</strong> 缺乏 License 的二进制文件</li><li>源码文件都包含标准 <code>ASF License</code> 头 (这个用插件跑一下为主)</li><li>检查每个父 / 子模块的 <code>pom.xml</code> 版本号是否一致 (且符合期望)</li><li>最后,确保源码可以正常 / 正确编译 (然后看看测试和规范)</li></ol><p>PMC 同学请特别注意认真检查 <code>LICENSE</code> + <code>NOTICE</code> 文件,确保文件严格遵循了 ASF 的发版要求,
大部分的发版问题都与之相关</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 请优先使用/切换到 `java 11` 版本进行后序的编译和运行操作 (注:`Computer` 仅支持 `java &gt;= 11`) </span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># java --version</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># 尝试在 Unix 环境下编译测试是否正常 (stage 表示从 stage 仓库拉取依赖)</span>
</span></span><span style=display:flex><span>mvn clean package -P stage -Dmaven.test.skip<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87>true</span> -Dcheckstyle.skip<span style=color:#ce5c00;font-weight:700>=</span><span style=color:#204a87>true</span>
</span></span></code></pre></div><h5 id=b-二进制包>B. 二进制包</h5><p>解压 <code>xxx-hugegraph.tar.gz</code>后,进行如下检查:</p><ol><li>文件夹都带有 <code>incubating</code></li><li>存在 <code>LICENSE</code> + <code>NOTICE</code> 文件并且内容正常</li><li>服务启动</li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#8f5902;font-style:italic># hugegraph-server</span>
</span></span><span style=display:flex><span>bin/start-hugegraph.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># hugegraph-loader</span>
</span></span><span style=display:flex><span>bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic># hugegraph-hubble</span>
</span></span><span style=display:flex><span>bin/start-hubble.sh
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>更多参考官网: https://hugegraph.apache.org/cn/docs/quickstart
</span></span></code></pre></div><p><strong>注:</strong> 如果二进制包里面引入了第三方依赖, 则需要更新 LICENSE, 加入第三方依赖的 LICENSE; 若第三方依赖
LICENSE 是 Apache 2.0, 且对应的项目中包含了 NOTICE, 则还需要更新我们的 NOTICE 文件</p><h4 id=5-检查官网以及-github-等页面>5. 检查官网以及 github 等页面</h4><ol><li>确保官网至少满足 <a href=https://whimsy.apache.org/pods/project/hugegraph>apache website check</a>,
以及没有死链等</li><li>更新<strong>下载链接</strong>存在,以及版本更新说明页面更新</li><li>&mldr;</li></ol><h2 id=邮件模板>邮件模板</h2><p>检查完成后,你应该按不同角色回复邮件:(普通开发者 & PMC 成员)</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-markdown data-lang=markdown><span style=display:flex><span>[] +1 approve
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[] +0 no opinion
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[] -1 disapprove with the reason
</span></span></code></pre></div><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-markdown data-lang=markdown><span style=display:flex><span>+1 (non-binding)
</span></span><span style=display:flex><span>I checked:
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>1.</span> Download link/tag in mail are valid
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>2.</span> Checksum and GPG signatures are OK
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>3.</span> LICENSE <span style=color:#a40000>&amp;</span> NOTICE <span style=color:#a40000>&amp;</span> DISCLAIMER are exist
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>4.</span> Build successfully on XX OS version XXX
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>5.</span> No unexpected binary files
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>6.</span> Date is right in the NOTICE file
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>7.</span> Compile from source is fine under JavaX
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>8.</span> No empty file <span style=color:#a40000>&amp;</span> directory found
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>9.</span> Test running xxx service OK
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>10.</span> ....
</span></span></code></pre></div><p>特别注意 PMC 成员必须使用 <code>binding</code> 标记回复邮件,这对于统计有效投票很重要;</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-markdown data-lang=markdown><span style=display:flex><span>+1 (binding)
</span></span><span style=display:flex><span>I checked:
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>1.</span> Download link/tag in mail are valid
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>2.</span> Checksum and GPG signatures are OK
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>3.</span> LICENSE <span style=color:#a40000>&amp;</span> NOTICE <span style=color:#a40000>&amp;</span> DISCLAIMER are exist
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>4.</span> Build successfully on XX OS Version XX
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>5.</span> No unexpected binary files
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>6.</span> Date is right in the NOTICE file
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>7.</span> Compile from source is fine under JavaXX
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>8.</span> No empty file <span style=color:#a40000>&amp;</span> directory found
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>9.</span> Test running XXX service OK
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>10.</span> ....
</span></span></code></pre></div></div><div class=td-content style=page-break-before:always><h1 id=pg-c89774a4e231af418639f53a926ea188>9.4 - 在 IDEA 中配置 Server 开发环境</h1><blockquote><p>注意:下述配置仅供参考,基于<a href=https://github.com/apache/incubator-hugegraph/commit/a946ad1de4e8f922251a5241ffc957c33379677f>这个版本</a>,在 Linux 和 macOS 平台下进行了测试。</p></blockquote><h3 id=背景>背景</h3><p><a href=/docs/quickstart/hugegraph-server/>Quick Start</a> 部分已经介绍了使用<strong>脚本</strong>启停 HugeGraph-Server 的流程。下面以 Linux 平台为例,
介绍使用 <strong>IntelliJ IDEA</strong> 运行与调试 HugeGraph-Server 的流程。</p><p>本地启动的核心与<strong>脚本启动</strong>是一样的:</p><ol><li>初始化数据库后端,执行 <code>InitStore</code> 类初始化图</li><li>启动 HugeGraph-Server,执行 <code>HugeGraphServer</code> 类加载初始化的图信息启动</li></ol><p>在执行下述流程之前,请确保已经克隆了 HugeGraph 的源代码,并且已经配置了 Java 11 环境 & 可以参考这个
<a href=https://github.com/apache/incubator-hugegraph/wiki/The-style-config-for-HugeGraph-in-IDEA>配置文档</a></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>git clone https://github.com/apache/hugegraph.git
</span></span></code></pre></div><h3 id=步骤>步骤</h3><h4 id=1-配置文件拷贝>1. 配置文件拷贝</h4><p>为了避免配置文件的更改影响 Git 的追踪,建议将所需的配置文件拷贝到一个单独的文件夹中:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>cp -r hugegraph-dist/src/assembly/static/scripts hugegraph-dist/src/assembly/static/conf path-to-your-directory
</span></span></code></pre></div><p><code>path-to-your-directory</code> 替换为你创建的文件夹的路径。</p><h4 id=2-initstore-类初始化图>2. <code>InitStore</code> 类初始化图</h4><p>首先,需要在配置文件中配置数据库后端。以 RocksDB 为例,在 <code>path-to-your-directory/conf/graphs/hugegraph.properties</code> 文件中进行以下配置:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-fallback data-lang=fallback><span style=display:flex><span>backend=rocksdb
</span></span><span style=display:flex><span>serializer=binary
</span></span><span style=display:flex><span>rocksdb.data_path=.
</span></span><span style=display:flex><span>rocksdb.wal_path=.
</span></span></code></pre></div><p>然后,打开 IntelliJ IDEA 的 <code>Run/Debug Configurations</code> 面板,创建一个新的 Application 配置,按照以下步骤进行配置:</p><ul><li><code>Use classpath of module</code> 中选择 <code>hugegraph-dist</code></li><li><code>Main class</code> 设置为 <code>org.apache.hugegraph.cmd.InitStore</code></li><li>设置运行参数为 <code>conf/rest-server.properties</code>,这里的路径是相对于工作路径的,需要将工作路径设置为 <code>path-to-your-directory</code></li></ul><blockquote><p>若在 <strong>Java 11</strong> 环境下为 HugeGraph-Server 配置了<strong>用户认证</strong> (authenticator),需要参考二进制包的脚本<a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/src/assembly/static/bin/init-store.sh#L52>配置</a>,添加下述 <strong>VM options</strong>:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>--add-exports<span style=color:#ce5c00;font-weight:700>=</span>java.base/jdk.internal.reflect<span style=color:#ce5c00;font-weight:700>=</span>ALL-UNNAMED
</span></span></code></pre></div><p>否则会报错:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>reflect</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>InaccessibleObjectException</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>Unable</span> <span style=color:#000>to</span> <span style=color:#000>make</span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>synchronized</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>jdk</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>internal</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>reflect</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>Reflection</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>registerFieldsToFilter</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>Class</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>String</span><span style=color:#ce5c00;font-weight:700>[])</span> <span style=color:#000>accessible</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>module</span> <span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>base</span> <span style=color:#000>does</span> <span style=color:#000>not</span> <span style=color:#4e9a06>&#34;exports jdk.internal.reflect&#34;</span> <span style=color:#000>to</span> <span style=color:#000>unnamed</span> <span style=color:#000>module</span> <span style=color:#5c35cc;font-weight:700>@xxx</span>
</span></span></code></pre></div></blockquote><p>配置完成后运行,如果运行成功,将会输出以下类似运行日志:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>37</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>u</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>ConfigUtil</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Scanning</span> <span style=color:#000>option</span> <span style=color:#a40000>&#39;</span><span style=color:#000>graphs</span><span style=color:#a40000>&#39;</span> <span style=color:#000>directory</span> <span style=color:#a40000>&#39;</span><span style=color:#ce5c00;font-weight:700>./</span><span style=color:#000>conf</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>graphs</span><span style=color:#a40000>&#39;</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>37</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>c</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>InitStore</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Init</span> <span style=color:#000>graph</span> <span style=color:#000>with</span> <span style=color:#000>config</span> <span style=color:#000>file</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#ce5c00;font-weight:700>./</span><span style=color:#000>conf</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>graphs</span><span style=color:#ce5c00;font-weight:700>/</span><span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>properties</span>
</span></span><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>......</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>b</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>r</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>RocksDBStore</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Write</span> <span style=color:#000>down</span> <span style=color:#000>the</span> <span style=color:#000>backend</span> <span style=color:#000>version</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>11</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>StandardHugeGraph</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Graph</span> <span style=color:#a40000>&#39;</span><span style=color:#000>hugegraph</span><span style=color:#a40000>&#39;</span> <span style=color:#000>has</span> <span style=color:#000>been</span> <span style=color:#000>initialized</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>StandardHugeGraph</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Close</span> <span style=color:#000>graph</span> <span style=color:#000>standardhugegraph</span><span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>]</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>db</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>open</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>b</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>r</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>RocksDBStore</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Opening</span> <span style=color:#000>RocksDB</span> <span style=color:#000>with</span> <span style=color:#000>data</span> <span style=color:#000>path</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#ce5c00;font-weight:700>./</span><span style=color:#000>m</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>db</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>open</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>b</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>r</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>RocksDBStore</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Opening</span> <span style=color:#000>RocksDB</span> <span style=color:#000>with</span> <span style=color:#000>data</span> <span style=color:#000>path</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#ce5c00;font-weight:700>./</span><span style=color:#000>s</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>db</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>open</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>b</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>r</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>RocksDBStore</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Opening</span> <span style=color:#000>RocksDB</span> <span style=color:#000>with</span> <span style=color:#000>data</span> <span style=color:#000>path</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#ce5c00;font-weight:700>./</span><span style=color:#000>g</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>main</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>HugeFactory</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>HugeFactory</span> <span style=color:#000>shutdown</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>43</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>39</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>hugegraph</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>shutdown</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>h</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>HugeFactory</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>HugeGraph</span> <span style=color:#000>is</span> <span style=color:#000>shutting</span> <span style=color:#000>down</span>
</span></span></code></pre></div><h4 id=3-运行-hugegraphserver>3. 运行 <code>HugeGraphServer</code></h4><p>类似地,打开 IntelliJ IDEA 的 <code>Run/Debug Configurations</code> 面板,创建一个新的 <code>Application</code> 配置,按照以下步骤进行配置:</p><ul><li><code>Use classpath of module</code> 中选择 <code>hugegraph-dist</code></li><li><code>Main class</code> 设置为 <code>org.apache.hugegraph.dist.HugeGraphServer</code></li><li>设置运行参数为 <code>conf/gremlin-server.yaml conf/rest-server.properties</code>,同样地,这里的路径是相对于工作路径的,需要将工作路径设置为 <code>path-to-your-directory</code></li></ul><blockquote><p>类似的,若在 <strong>Java 11</strong> 环境下为 HugeGraph-Server 配置了<strong>用户认证</strong> (authenticator),同样需要参考二进制包的脚本<a href=https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh#L124>配置</a>,添加下述 <strong>VM options</strong>:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>--add-exports<span style=color:#ce5c00;font-weight:700>=</span>java.base/jdk.internal.reflect<span style=color:#ce5c00;font-weight:700>=</span>ALL-UNNAMED --add-modules<span style=color:#ce5c00;font-weight:700>=</span>jdk.unsupported --add-exports<span style=color:#ce5c00;font-weight:700>=</span>java.base/sun.nio.ch<span style=color:#ce5c00;font-weight:700>=</span>ALL-UNNAMED
</span></span></code></pre></div><p>否则会报错:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>reflect</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>InaccessibleObjectException</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>Unable</span> <span style=color:#000>to</span> <span style=color:#000>make</span> <span style=color:#204a87;font-weight:700>public</span> <span style=color:#204a87;font-weight:700>static</span> <span style=color:#204a87;font-weight:700>synchronized</span> <span style=color:#204a87;font-weight:700>void</span> <span style=color:#000>jdk</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>internal</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>reflect</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>Reflection</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>registerFieldsToFilter</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>Class</span><span style=color:#ce5c00;font-weight:700>,</span><span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>lang</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>String</span><span style=color:#ce5c00;font-weight:700>[])</span> <span style=color:#000>accessible</span><span style=color:#ce5c00;font-weight:700>:</span> <span style=color:#000>module</span> <span style=color:#000>java</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>base</span> <span style=color:#000>does</span> <span style=color:#000>not</span> <span style=color:#4e9a06>&#34;exports jdk.internal.reflect&#34;</span> <span style=color:#000>to</span> <span style=color:#000>unnamed</span> <span style=color:#000>module</span> <span style=color:#5c35cc;font-weight:700>@xxx</span>
</span></span></code></pre></div></blockquote><p>配置完成后运行,如果看到以下类似日志,表示 <code>HugeGraphServer</code> 已经成功启动:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#ce5c00;font-weight:700>......</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>51</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>56</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>server</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>boss</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>t</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>GremlinServer</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Gremlin</span> <span style=color:#000>Server</span> <span style=color:#000>configured</span> <span style=color:#000>with</span> <span style=color:#000>worker</span> <span style=color:#000>thread</span> <span style=color:#000>pool</span> <span style=color:#000>of</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>gremlin</span> <span style=color:#000>pool</span> <span style=color:#000>of</span> <span style=color:#000>8</span> <span style=color:#000>and</span> <span style=color:#000>boss</span> <span style=color:#000>thread</span> <span style=color:#000>pool</span> <span style=color:#000>of</span> <span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>.</span>
</span></span><span style=display:flex><span><span style=color:#000>2023</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>06</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>05</span> <span style=color:#000>00</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>51</span><span style=color:#ce5c00;font-weight:700>:</span><span style=color:#000>56</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>gremlin</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>server</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>boss</span><span style=color:#ce5c00;font-weight:700>-</span><span style=color:#000>1</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#ce5c00;font-weight:700>[</span><span style=color:#000>INFO</span><span style=color:#ce5c00;font-weight:700>]</span> <span style=color:#000>o</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>a</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>t</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>g</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>s</span><span style=color:#ce5c00;font-weight:700>.</span><span style=color:#c4a000>GremlinServer</span> <span style=color:#ce5c00;font-weight:700>-</span> <span style=color:#000>Channel</span> <span style=color:#000>started</span> <span style=color:#000>at</span> <span style=color:#000>port</span> <span style=color:#000>8182</span><span style=color:#ce5c00;font-weight:700>.</span>
</span></span></code></pre></div><h4 id=4-调试-hugegraphserver-可选>4. 调试 <code>HugeGraphServer</code> (可选)</h4><p>在完成上述配置后,可以尝试对 <code>HugeGraphServer</code> 进行调试。在调试模式下运行 <code>HugeGraphServer</code>,并在以下<a href=https://github.com/apache/hugegraph/blob/a946ad1de4e8f922251a5241ffc957c33379677f/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java#L238>位置</a>设置断点:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-java data-lang=java><span style=display:flex><span><span style=color:#204a87;font-weight:700>public</span> <span style=color:#000>String</span> <span style=color:#000>list</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#5c35cc;font-weight:700>@Context</span> <span style=color:#000>GraphManager</span> <span style=color:#000>manager</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@PathParam</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;graph&#34;</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>String</span> <span style=color:#000>graph</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#5c35cc;font-weight:700>@QueryParam</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;label&#34;</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>String</span> <span style=color:#000>label</span><span style=color:#ce5c00;font-weight:700>,</span>
</span></span><span style=display:flex><span> <span style=color:#5c35cc;font-weight:700>@QueryParam</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#4e9a06>&#34;properties&#34;</span><span style=color:#ce5c00;font-weight:700>)</span> <span style=color:#000>String</span> <span style=color:#000>properties</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#ce5c00;font-weight:700>......)</span> <span style=color:#ce5c00;font-weight:700>{</span>
</span></span><span style=display:flex><span> <span style=color:#8f5902;font-style:italic>// ignore log
</span></span></span><span style=display:flex><span><span style=color:#8f5902;font-style:italic></span> <span style=color:#000>Map</span><span style=color:#ce5c00;font-weight:700>&lt;</span><span style=color:#000>String</span><span style=color:#ce5c00;font-weight:700>,</span> <span style=color:#000>Object</span><span style=color:#ce5c00;font-weight:700>&gt;</span> <span style=color:#000>props</span> <span style=color:#ce5c00;font-weight:700>=</span> <span style=color:#000>parseProperties</span><span style=color:#ce5c00;font-weight:700>(</span><span style=color:#000>properties</span><span style=color:#ce5c00;font-weight:700>);</span>
</span></span></code></pre></div><p>然后,使用 RESTful API 请求 <code>HugeGraphServer</code></p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>curl <span style=color:#4e9a06>&#34;http://localhost:8080/graphs/hugegraph/graph/vertices&#34;</span> <span style=color:#000;font-weight:700>|</span> gunzip
</span></span></code></pre></div><p>此时,可以在调试器中查看详细的变量信息。</p><h4 id=5-log4j2-日志配置>5. Log4j2 日志配置</h4><p>默认情况下,运行 <code>InitStore</code><code>HugeGraphServer</code> 时,读取的 Log4j2 配置文件路径为 <code>hugegraph-dist/src/main/resources/log4j2.xml</code>,而不是 <code>path-to-your-directory/conf/log4j2.xml</code>,这个配置文件是使用<strong>脚本</strong>启动 HugeGraph-Server 时读取的。</p><p>为了避免同时维护两份配置文件,可以考虑在 <strong>IntelliJ IDEA</strong> 运行与调试 HugeGraph-Server 时,修改读取的 Log4j2 配置文件路径:</p><ol><li>打开之前创建的 <code>Application</code> 配置</li><li>点击 <code>Modify options</code> - <code>Add VM options</code></li><li>设置 VM options 为 <code>-Dlog4j.configurationFile=conf/log4j2.xml</code></li></ol><h3 id=可能遇到的问题>可能遇到的问题</h3><h4 id=1-java-package-sunmisc-does-not-exist>1. java: package sun.misc does not exist</h4><p>原因可能是在使用 <strong>Java 11</strong> 编译时触发了交叉编译,导致项目中使用的 <code>sun.misc.Unsafe</code> 找不到符号。有两种解决方案可供选择:</p><ol><li>在 IntelliJ IDEA 的 <code>Preferences/Settings</code> 中找到 <code>Java Compiler</code> 面板,然后关闭 <code>--release</code> 选项 (推荐)</li><li>或者将项目的 SDK 版本设置为 8 (Deprecated soon)</li></ol><h4 id=2-java-storeraftrpcraftrequests-does-not-exist-rpc-generated-files>2. java: *.store.raft.rpc.RaftRequests does not exist (RPC Generated Files)</h4><p>原因是源代码没有包含 <code>RPC-generated</code> 文件。可以尝试两种方法来解决:</p><ol><li>[命令] 在根目录下运行 <code>mvn clean compile -DskipTests</code> (<strong>推荐</strong>)</li><li>[UI] 在 IDEA 中,右键点击 <code>hugegraph</code> 模块,选择 <code>Manve -> Generate Sources and Update Folders</code></li></ol><h4 id=3-log4j2-日志无法打印-l-等位置信息>3. Log4j2 日志无法打印 %l 等位置信息</h4><p>这是因为 Log4j2 中使用了 asynchronous loggers,可以参考<a href=https://logging.apache.org/log4j/2.x/manual/layouts.html#LocationInformation>官方文档</a>进行配置</p><hr><h5 id=参考>参考</h5><ol><li><a href=/docs/quickstart/hugegraph-server/>HugeGraph-Server Quick Start</a></li><li><a href=https://gist.github.com/imbajin/1661450f000cd62a67e46d4f1abfe82c>hugegraph-server 本地调试文档 (Win/Unix)</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-180033>&ldquo;package sun.misc does not exist&rdquo; compilation error</a></li><li><a href=https://youtrack.jetbrains.com/issue/IDEA-201168>Cannot compile: java: package sun.misc does not exist</a></li><li><a href=https://github.com/apache/incubator-hugegraph/wiki/The-style-config-for-HugeGraph-in-IDEA>The code-style config for HugeGraph in IDEA</a></li></ol></div><div class=td-content style=page-break-before:always><h1 id=pg-e1fc3666faccec72ead94a2ed6a9f8a3>9.5 - Apache HugeGraph Committer 指南</h1><blockquote><p>本文档概述了 Apache Committer 推选要求以及流程,对应的 ASF 官方文档可见:https://community.apache.org/newcommitter.html</p></blockquote><h1 id=候选人要求>候选人要求</h1><ol><li>候选人应遵守 <a href=https://www.apache.org/foundation/policies/conduct.html>Apache Code of Conduct</a></li><li>PMC 成员将通过搜索<a href=https://lists.apache.org/list?dev@hugegraph.apache.org>邮件列表</a><a href=https://github.com/apache/hugegraph/issues>issues</a><a href=https://github.com/apache/incubator-hugegraph/pulls>PRs</a><a href=https://hugegraph.apache.org/docs>官网文档</a>等方式,了解候选人如何与他人互动,以及他们所做的贡献</li><li>以下是在评估候选人是否适合成为 Committer 时需要考虑的一些要点:<ol><li>与社区成员合作的能力</li><li>担任导师的能力</li><li>社区参与度</li><li>贡献程度</li><li>个人技能/能力</li></ol></li></ol><h1 id=推选详细流程>推选详细流程</h1><p><strong>讨论 (DISCUSS) → 投票 (VOTE) → 邀请 (INVITE) → 公告 (ANNOUNCE)</strong></p><h2 id=1-发起社区邮件讨论-discuss>1. 发起社区邮件讨论 (DISCUSS)</h2><p>任何 HugeGraph 的 (P)PMC 成员都可以发起投票讨论,在发现社区贡献者任何有价值的贡献并取得候选人本人同意后,可以在 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a> 发起讨论。
讨论邮件里提议者要把候选人的贡献说清楚,并最好给出确认贡献的 URL 等信息,便于大家讨论分析。</p><p>下面是 HugeGraph 对应的邮件模板:(仅供参考)</p><blockquote><p>Note: 后续将使用 xxx 指代候选人名,一般 <code>xxx</code> 为一个容易读的名字 (例如 <code>Simon Jay</code>)</p><p><code>ASF-INFRA</code> 建议<strong>避免</strong>使用不易读的 <code>ID</code> 直接作为邮件<strong>人名代指</strong> (例如<strong>避免</strong> <code>simon321</code><code>wh0isSim0n</code> 😄)</p><p>另发送邮件最好选择 <strong>&ldquo;纯文本&rdquo;</strong> 模式,否则排版在 ASF Mail UI 中可能会乱</p></blockquote><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-markdown data-lang=markdown><span style=display:flex><span>To: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: [DISCUSS] XXX as a HugeGraph Committer Candidate
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hi all:
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>I am pleased to nominate xxx for the role of HugeGraph Committer based on his/her contributions over the past few months.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[ Candidate&#39;s Contribution Summary ]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Here are the relevant PRs (issues) he/she has participated in:
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>**Core Features:**</span>
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>-</span> Feature 1: [ Reference Links ]
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>-</span> ...
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>**Fix/Chore/Release:**</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span><span style=color:#000;font-weight:700>**Doc:**</span>
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[ Candidate&#39;s Current Notable Contributions ]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>His/Her contributions bring the following benefits to the community, helping us in the following ways:
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[ Candidate&#39;s Contributions and Benefits to the Community ]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>In view of the above contributions, I elect xxx as Committer of the HugeGraph project.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>[ Reference Links ]
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>1.</span> PR1
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>2.</span> PR2
</span></span><span style=display:flex><span><span style=color:#204a87;font-weight:700>3.</span> ...
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Welcome everyone to share opinions~
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Thanks!
</span></span></code></pre></div><p>对于讨论邮件中贡献链接,可以使用 <a href=https://github.com/search>GitHub Search</a> 的统计功能,按需输入如下对应关键词查询即可,可以在此基础上添加新的 repo 如 <code>repo:apache/incubator-hugegraph-computer</code>,特别注意调整<strong>时间范围</strong> (下面是一个模板参考,请自行调整参数):</p><ul><li>PR 提交次数<ul><li><code>is:pr author:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>代码提交/修改行数<ul><li><a href="https://github.com/apache/incubator-hugegraph/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c">https://github.com/apache/incubator-hugegraph/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c</a></li><li><a href="https://github.com/apache/incubator-hugegraph-doc/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c">https://github.com/apache/incubator-hugegraph-doc/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c</a></li></ul></li><li>PR 提交关联 Issue 次数<ul><li><code>linked:issue involves:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>PR Review 个数<ul><li><code>type:pr reviewed-by:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>PR Review 行数</li><li>合并次数<ul><li><code>type:pr author:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>有效合并行数<ul><li><a href="https://github.com/apache/incubator-hugegraph/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c">https://github.com/apache/incubator-hugegraph/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c</a></li><li><a href="https://github.com/apache/incubator-hugegraph-doc/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c">https://github.com/apache/incubator-hugegraph-doc/graphs/contributors?from=2023-06-01&to=2023-12-25&type=c</a></li></ul></li><li>Issue 提交数<ul><li><code>type:issue author:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>Issue 修复数<ul><li>在 Issue 提交数的基础上选取状态为 closed 的 Issues</li></ul></li><li>Issue 参与数<ul><li><code>type:issue involves:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>评论 Issue 数<ul><li><code>type:issue commenter:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li><li>评论 PR 数<ul><li><code>type:pr commenter:xxx repo:apache/incubator-hugegraph repo:apache/incubator-hugegraph-doc created:>2023-06-01 updated:&lt;2023-12-25</code></li></ul></li></ul><p>Mailing Lists 的参与则可使用 <a href="https://lists.apache.org/list?dev@hugegraph.apache.org:lte=10M:xxx">https://lists.apache.org/list?dev@hugegraph.apache.org:lte=10M:xxx</a> 查询。</p><h2 id=2-发起社区邮件投票-vote>2. 发起社区邮件投票 (VOTE)</h2><p>如果讨论邮件在规定时间内没有收到分歧信息,投票发起者需要在 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a> 发起对 Committer 的选举投票。</p><p>下面是对应的邮件模板:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: [VOTE] xxx as a HugeGraph Committer
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hi all:
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Through the discussion of last week:
</span></span><span style=display:flex><span>[ Discussion Mailing List Link ]
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>We have discussed and listed what xxx participated in the HugeGraph community.
</span></span><span style=display:flex><span>I believe making him/her a Committer will enhance the work for HugeGraph.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>So, I am happy to call VOTE to accept xxx as a HugeGraph Committer.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Voting will continue for at least 72 hours or until the required number of votes is reached.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Please vote accordingly:
</span></span><span style=display:flex><span>[ ] +1 approve
</span></span><span style=display:flex><span>[ ] +0 no opinion
</span></span><span style=display:flex><span>[ ] -1 disapprove with the reason
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Thanks!
</span></span></code></pre></div><p>然后 (P)PMC 成员回复 +1 或 -1 的邮件回复表达意见,一般来说至少需要 ≥3 票 +1 才能结束投票。</p><h2 id=宣布投票结果-result>宣布投票结果 (RESULT)</h2><p>投票邮件结束后,投票发起者需要邮件里提醒投票结束。同时,投票发起者需要发起邮件宣布投票结果,发送至 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a>,邮件模板可参考:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: [RESULTS][VOTE] xxx as a HugeGraph Committer
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hi all: The vote for &#34;xxx&#34; as an HugeGraph Committer has PASSED and closed now.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>The result is as follows: X PMC +1 Votes:
</span></span><span style=display:flex><span>- A (PMC ID)
</span></span><span style=display:flex><span>- B
</span></span><span style=display:flex><span>- C...
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Vote thread:
</span></span><span style=display:flex><span>put vote thread link here
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Then I&#39;m going to invite xxx to join us soon. Thanks for everyone&#39;s support!
</span></span></code></pre></div><h2 id=向候选人发起邮件邀请-invite>向候选人发起邮件邀请 (INVITE)</h2><p>宣布投票结果邮件发出后,投票发起人要给候选人发送邀请邮件。邀请邮件主送候选人,抄送 <a href=mailto:private@hugegraph.apache.org>private@hugegraph.apache.org</a>,被邀请的候选人必须通过指定的邮箱地址回复接受或者拒绝该邀请。</p><p>下面是对应可参考的邮件模板:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: [ Candidate&#39;s Email ]
</span></span><span style=display:flex><span>Cc: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: Invitation to become HugeGraph committer: xxx
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hello xxx,
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>The HugeGraph Project Management Committee (PPMC)
</span></span><span style=display:flex><span>hereby offers you committer privileges to the project.
</span></span><span style=display:flex><span>These privileges are offered on the understanding that you&#39;ll use them
</span></span><span style=display:flex><span>reasonably and with common sense. We like to work on trust
</span></span><span style=display:flex><span>rather than unnecessary constraints.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Being a committer enables you to more easily make
</span></span><span style=display:flex><span>changes without needing to go through the patch
</span></span><span style=display:flex><span>submission process.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Being a committer does not require you to
</span></span><span style=display:flex><span>participate any more than you already do. It does
</span></span><span style=display:flex><span>tend to make one even more committed. You will
</span></span><span style=display:flex><span>probably find that you spend more time here.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Of course, you can decline and instead remain as a
</span></span><span style=display:flex><span>contributor, participating as you do now.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>A. This personal invitation is a chance for you to
</span></span><span style=display:flex><span>accept or decline in private. Either way, please
</span></span><span style=display:flex><span>let us know in reply to the private@hugegraph.apache.org
</span></span><span style=display:flex><span>address only.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>B. If you accept, the next step is to register an iCLA:
</span></span><span style=display:flex><span> 1. Details of the iCLA and the forms are found
</span></span><span style=display:flex><span> through this link: https://www.apache.org/licenses/#clas
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> 2. Instructions for its completion and return to
</span></span><span style=display:flex><span> the Secretary of the ASF are found at
</span></span><span style=display:flex><span> https://www.apache.org/licenses/#submitting
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span> 3. When you transmit the completed iCLA, request
</span></span><span style=display:flex><span> to notify the Apache HugeGraph project and choose a
</span></span><span style=display:flex><span> unique Apache ID. Look to see if your preferred
</span></span><span style=display:flex><span> ID is already taken at
</span></span><span style=display:flex><span> https://people.apache.org/committer-index.html
</span></span><span style=display:flex><span> This will allow the Secretary to notify the PMC
</span></span><span style=display:flex><span> when your iCLA has been recorded.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>When recording of your iCLA is noted, you will
</span></span><span style=display:flex><span>receive a follow-up message with the next steps for
</span></span><span style=display:flex><span>establishing you as a committer.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>With the expectation of your acceptance, welcome!
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>The Apache HugeGraph(incubating) PPMC
</span></span></code></pre></div><h2 id=候选人接受邀请-accept>候选人接受邀请 (ACCEPT)</h2><p>候选人应回复上述邮件 (选择 <strong>reply all</strong>),表明接受邀请,邮件模板可参考:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: [ Sender&#39;s Email ]
</span></span><span style=display:flex><span>Cc: private@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: Re: Invitation to become HugeGraph committer: xxx
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hello Apache HugeGraph(incubating) PPMC,
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>I accept the invitation.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Thanks to the Apache HugeGraph Community for recognizing my work, I
</span></span><span style=display:flex><span>will continue to actively participate in the work of the Apache
</span></span><span style=display:flex><span>HugeGraph(incubating).
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Next, I will follow the instructions to complete the next steps:
</span></span><span style=display:flex><span>Signing and submitting iCLA and registering Apache ID.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>xxx
</span></span></code></pre></div><p>当然,候选人也可以选择拒绝邀请,这里就没有模板了:)</p><p>一旦邀请被接受,候选人需要完成以下事项:</p><ul><li>订阅 <a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a>,具体步骤/过滤等配置请参考<a href=https://hugegraph.apache.org/docs/contribution-guidelines/subscribe/>文档</a></li><li>签署 <a href=https://www.apache.org/licenses/icla.pdf>ICLA</a>,具体步骤见下↓</li></ul><h3 id=icla-签署流程>ICLA 签署流程</h3><ol><li>下载 <a href=https://www.apache.org/licenses/icla.pdf>ICLA</a></li><li>打开 PDF 并填写相关内容,均需要全英文填写,建议使用 PDF 工具编辑并署名<ol><li><strong>Full name</strong>: 名字在前,姓氏在后</li><li><strong>Public name</strong>: 可以不填,默认和 <code>Full name</code> 相同</li><li>勾选 check this box only if you enter names with your family name first</li><li><strong>Postal Address</strong>: 英文地址,从小地方到大地方的顺序来写,需详细到门牌号</li><li><strong>Country:</strong> 所在国家英文</li><li><strong>E-mail</strong>: 邮箱地址,建议与上述邮件中使用的邮箱相同</li><li><strong>(optional) preferred Apache id(s)</strong>: 选择一个 <a href=http://people.apache.org/committer-index.html>Apache committer</a> 页面不存在的 <strong>SVN ID</strong></li><li><strong>(optional) notify project</strong>:Apache HugeGraph(incubating)</li><li><strong>签名:务必使用 PDF 工具手写</strong></li><li><strong>Date:</strong> 格式 xxxx-xx-xx</li></ol></li><li>签署完之后将 <code>icla.pdf</code> 重命名为 <code>姓名拼音-icla.pdf</code></li><li>发送下述邮件,并附件引用 <code>姓名拼音-icla.pdf</code></li></ol><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: secretary@apache.org
</span></span><span style=display:flex><span>Subject: ICLA Information
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hello everyone:
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>I have accepted the Apache HugeGraph(incubating) PPMC invitation to
</span></span><span style=display:flex><span>become a HugeGraph committer, the attachment is my ICLA information.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>(Optional) My GitHub account is https://github.com/xxx. Thanks!
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>xxx
</span></span></code></pre></div><blockquote><p>更多注意事项可参考 <a href=https://github.com/apache/hugegraph/issues/1732>https://github.com/apache/hugegraph/issues/1732</a></p></blockquote><p>PMC 成员将等待 <code>Apache secretary</code> 团队确认 <code>ICLA</code> 备案,候选人和 PMC 成员将收到以下电子邮件:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>Dear xxx,
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>This message acknowledges receipt of your ICLA, which has been filed in the Apache Software Foundation records.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Your account (with id xxx) has been requested for you and you should receive email with next steps
</span></span><span style=display:flex><span>within the next few days (this process can take up to a week).
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Please refer to https://www.apache.org/foundation/how-it-works.html#developers
</span></span><span style=display:flex><span>for more information about roles at Apache.
</span></span></code></pre></div><h3 id=设置-apache-账号和开发环境-config>设置 Apache 账号和开发环境 (CONFIG)</h3><p>备案完成后,候选人将收到来自 <a href=mailto:root@apache.org>root@apache.org</a> 主题为 <code>Welcome to the Apache Software Foundation</code> 的邮件,此时需按照邮件中的步骤设置 Apache 账号和开发环境:</p><ol><li>重置密码 <a href=https://id.apache.org/reset/enter>https://id.apache.org/reset/enter</a></li><li>配置个人信息 <a href=https://whimsy.apache.org/roster/committer/xxx>https://whimsy.apache.org/roster/committer/xxx</a></li><li>关联 GitHub 账号 <a href=https://gitbox.apache.org/boxer>https://gitbox.apache.org/boxer</a><ol><li>这一步需要配置 GitHub 双重身份验证 (2FA)</li></ol></li><li><strong>负责提名的 PMC 成员需通过 <a href=https://whimsy.apache.org/roster/ppmc/hugegraph>Roster</a> 页面,将新的 Committer 添加到官方提交者列表中</strong> (<strong>重要</strong>, 否则仓库权限不生效)<ol><li>在这一步后,候选人即新的 Committer 才拥有对 GitHub HugeGraph 仓库的写权限</li></ol></li><li>(可选) 新的 Committer 可以使用 Apache 账号<a href=https://www.jetbrains.com/shop/eform/apache>申请</a>免费使用 Jetbrains 的全系列产品</li></ol><h2 id=发布公告邮件-announce>发布公告邮件 (ANNOUNCE)</h2><p>当候选人完成上述步骤后,候选人将正式成为 HugeGraph 的 Committer,此时需要向 <a href=mailto:dev@hugegraph.apache.org>dev@hugegraph.apache.org</a> 发送公告邮件,邮件模板可参考:</p><div class=highlight><pre tabindex=0 style=background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>To: dev@hugegraph.apache.org
</span></span><span style=display:flex><span>Subject: [ANNOUNCE] New Committer: xxx
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Hi everyone, The PPMC for Apache HugeGraph(incubating) has invited xxx to
</span></span><span style=display:flex><span>become a Committer and we are pleased to announce that he/she has accepted.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>xxx is being active in the HugeGraph community &amp; dedicated to ... modules,
</span></span><span style=display:flex><span>and we are glad to see his/her more interactions with the community in the future.
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>(Optional) His/Her GitHub account is https://github.com/xxx
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Welcome xxx, and please enjoy your community journey~
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>Thanks!
</span></span><span style=display:flex><span>
</span></span><span style=display:flex><span>The Apache HugeGraph PPMC
</span></span></code></pre></div><h1 id=参考>参考</h1><ol><li><a href=https://community.apache.org/newcommitter.html>https://community.apache.org/newcommitter.html</a> (ASF 官方文档)</li><li><a href=https://infra.apache.org/new-committers-guide.html>https://infra.apache.org/new-committers-guide.html</a></li><li><a href=https://www.apache.org/dev/pmc.html#newcommitter>https://www.apache.org/dev/pmc.html#newcommitter</a></li><li><a href=https://linkis.apache.org/zh-CN/community/how-to-vote-a-committer-pmc>https://linkis.apache.org/zh-CN/community/how-to-vote-a-committer-pmc</a></li><li><a href=https://www.apache.org/licenses/contributor-agreements.html#submitting>https://www.apache.org/licenses/contributor-agreements.html#submitting</a></li><li><a href=https://www.apache.org/licenses/cla-faq.html#printer>https://www.apache.org/licenses/cla-faq.html#printer</a></li><li><a href=https://linkis.apache.org/zh-CN/community/how-to-sign-apache-icla>https://linkis.apache.org/zh-CN/community/how-to-sign-apache-icla</a></li><li><a href=https://github.com/apache/hugegraph/issues/1732>https://github.com/apache/hugegraph/issues/1732</a> (HugeGraph ICLA related issue)</li></ol></div><div class=td-content style=page-break-before:always><h1 id=pg-d9ec0777c4f7a8a41476a65f2ecca6f7>10 - CHANGELOGS</h1></div><div class=td-content><h1 id=pg-6b37a0af49c5e6b45aeac03f2a71eab6>10.1 - HugeGraph 0.12 Release Notes</h1><h3 id=api--client>API & Client</h3><h4 id=接口更新>接口更新</h4><ul><li>支持 https + auth 模式连接图服务(hugegraph-client #109 #110)</li><li>统一 kout/kneighbor 等 OLTP 接口的参数命名及默认值(hugegraph-client #122 #123)</li><li>支持 RESTful 接口利用 P.textcontains() 进行属性全文检索(hugegraph #1312)</li><li>增加 graph_read_mode API 接口,以切换 OLTP、OLAP 读模式(hugegraph #1332)</li><li>支持 list/set 类型的聚合属性 aggregate property(hugegraph #1332)</li><li>权限接口增加 METRICS 资源类型(hugegraph #1355、hugegraph-client #114)</li><li>权限接口增加 SCHEMA 资源类型(hugegraph #1362、hugegraph-client #117)</li><li>增加手动 compact API 接口,支持 rocksdb/cassandra/hbase 后端(hugegraph #1378)</li><li>权限接口增加 login/logout API,支持颁发或回收 Token(hugegraph #1500、hugegraph-client #125)</li><li>权限接口增加 project API(hugegraph #1504、hugegraph-client #127)</li><li>增加 OLAP 回写接口,支持 cassandra/rocksdb 后端(hugegraph #1506、hugegraph-client #129)</li><li>增加返回一个图的所有 Schema 的 API 接口(hugegraph #1567、hugegraph-client #134)</li><li>变更 property key 创建与更新 API 的 HTTP 返回码为 202(hugegraph #1584)</li><li>增强 Text.contains() 支持 3 种格式:&ldquo;word&rdquo;、"(word)"、"(word1|word2|word3)"(hugegraph #1652)</li><li>统一了属性中特殊字符的行为(hugegraph #1670 #1684)</li><li>支持动态创建图实例、克隆图实例、删除图实例(hugegraph-client #135)</li></ul><h4 id=其它修改>其它修改</h4><ul><li>修复在恢复 index label 时 IndexLabelV56 id 丢失的问题(hugegraph-client #118)</li><li>为 Edge 类增加 name() 方法(hugegraph-client #121)</li></ul><h3 id=core--server>Core & Server</h3><h4 id=功能更新>功能更新</h4><ul><li>支持动态创建图实例(hugegraph #1065)</li><li>支持通过 Gremlin 调用 OLTP 算法(hugegraph #1289)</li><li>支持多集群使用同一个图权限服务,以共享权限信息(hugegraph #1350)</li><li>支持跨多节点的 Cache 缓存同步(hugegraph #1357)</li><li>支持 OLTP 算法使用原生集合以降低 GC 压力提升性能(hugegraph #1409)</li><li>支持对新增的 Raft 节点打快照或恢复快照(hugegraph #1439)</li><li>支持对集合属性建立二级索引 Secondary Index(hugegraph #1474)</li><li>支持审计日志,及其压缩、限速等功能(hugegraph #1492 #1493)</li><li>支持 OLTP 算法使用高性能并行无锁原生集合以提升性能(hugegraph #1552)</li></ul><h4 id=bug-修复>BUG 修复</h4><ul><li>修复带权最短路径算法(weighted shortest path)NPE 问题(hugegraph #1250)</li><li>增加 Raft 相关的安全操作白名单(hugegraph #1257)</li><li>修复 RocksDB 实例未正确关闭的问题(hugegraph #1264)</li><li>在清空数据 truncate 操作之后,显示的发起写快照 Raft Snapshot(hugegraph #1275)</li><li>修复 Raft Leader 在收到 Follower 转发请求时未更新缓存的问题(hugegraph #1279)</li><li>修复带权最短路径算法(weighted shortest path)结果不稳定的问题(hugegraph #1280)</li><li>修复 rays 算法 limit 参数不生效问题(hugegraph #1284)</li><li>修复 neighborrank 算法 capacity 参数未检查的问题(hugegraph #1290)</li><li>修复 PostgreSQL 因为不存在与用户同名的数据库而初始化失败的问题(hugegraph #1293)</li><li>修复 HBase 后端当启用 Kerberos 时初始化失败的问题(hugegraph #1294)</li><li>修复 HBase/RocksDB 后端 shard 结束判断错误问题(hugegraph #1306)</li><li>修复带权最短路径算法(weighted shortest path)未检查目标顶点存在的问题(hugegraph #1307)</li><li>修复 personalrank/neighborrank 算法中非 String 类型 id 的问题(hugegraph #1310)</li><li>检查必须是 master 节点才允许调度 gremlin job(hugegraph #1314)</li><li>修复 g.V().hasLabel().limit(n) 因为索引覆盖导致的部分结果不准确问题(hugegraph #1316)</li><li>修复 jaccardsimilarity 算法当并集为空时报 NaN 错误的问题(hugegraph #1324)</li><li>修复 Raft Follower 节点操作 Schema 多节点之间数据不同步问题(hugegraph #1325)</li><li>修复因为 tx 未关闭导致的 TTL 不生效问题(hugegraph #1330)</li><li>修复 gremlin job 的执行结果大于 Cassandra 限制但小于任务限制时的异常处理(hugegraph #1334)</li><li>检查权限接口 auth-delete 和 role-get API 操作时图必须存在(hugegraph #1338)</li><li>修复异步任务结果中包含 path/tree 时系列化不正常的问题(hugegraph #1351)</li><li>修复初始化 admin 用户时的 NPE 问题(hugegraph #1360)</li><li>修复异步任务原子性操作问题,确保 update/get fields 及 re-schedule 的原子性(hugegraph #1361)</li><li>修复权限 NONE 资源类型的问题(hugegraph #1362)</li><li>修复启用权限后,truncate 操作报错 SecurityException 及管理员信息丢失问题(hugegraph #1365)</li><li>修复启用权限后,解析数据忽略了权限异常的问题(hugegraph #1380)</li><li>修复 AuthManager 在初始化时会尝试连接其它节点的问题(hugegraph #1381)</li><li>修复特定的 shard 信息导致 base64 解码错误的问题(hugegraph #1383)</li><li>修复启用权限后,使用 consistent-hash LB 在校验权限时,creator 为空的问题(hugegraph #1385)</li><li>改进权限中 VAR 资源不再依赖于 VERTEX 资源(hugegraph #1386)</li><li>规范启用权限后,Schema 操作仅依赖具体的资源(hugegraph #1387)</li><li>规范启用权限后,部分操作由依赖 STATUS 资源改为依赖 ANY 资源(hugegraph #1391)</li><li>规范启用权限后,禁止初始化管理员密码为空(hugegraph #1400)</li><li>检查创建用户时 username/password 不允许为空(hugegraph #1402)</li><li>修复更新 Label 时,PrimaryKey 或 SortKey 被设置为可空属性的问题(hugegraph #1406)</li><li>修复 ScyllaDB 丢失分页结果问题(hugegraph #1407)</li><li>修复带权最短路径算法(weighted shortest path)权重属性强制转换为 double 的问题(hugegraph #1432)</li><li>统一 OLTP 算法中的 degree 参数命名(hugegraph #1433)</li><li>修复 fusiformsimilarity 算法当 similars 为空的时候返回所有的顶点问题(hugegraph #1434)</li><li>改进 paths 算法,当起始点与目标点相同时应该返回空路径(hugegraph #1435)</li><li>修改 kout/kneighbor 的 limit 参数默认值 10 为 10000000(hugegraph #1436)</li><li>修复分页信息中的 &lsquo;+&rsquo; 被 URL 编码为空格的问题(hugegraph #1437)</li><li>改进边更新接口的错误提示信息(hugegraph #1443)</li><li>修复 kout 算法 degree 未在所有 label 范围生效的问题(hugegraph #1459)</li><li>改进 kneighbor/kout 算法,起始点不允许出现在结果集中(hugegraph #1459 #1463)</li><li>统一 kout/kneighbor 的 Get 和 Post 版本行为(hugegraph #1470)</li><li>改进创建边时顶点类型不匹配的错误提示信息(hugegraph #1477)</li><li>修复 Range Index 的残留索引问题(hugegraph #1498)</li><li>修复权限操作未失效缓存的问题(hugegraph #1528)</li><li>修复 sameneighbor 的 limit 参数默认值 10 为 10000000(hugegraph #1530)</li><li>修复 clear API 不应该所有后端都调用 create snapshot 的问题(hugegraph #1532)</li><li>修复当 loading 模式时创建 Index Label 阻塞问题(hugegraph #1548)</li><li>修复增加图到 project 或从 project 移除图的问题(hugegraph #1562)</li><li>改进权限操作的一些错误提示信息(hugegraph #1563)</li><li>支持浮点属性设置为 Infinity/NaN 的值(hugegraph #1578)</li><li>修复 Raft 启用 safe_read 时的 quorum read 问题(hugegraph #1618)</li><li>修复 token 过期时间配置的单位问题(hugegraph #1625)</li><li>修复 MySQL Statement 资源泄露问题(hugegraph #1627)</li><li>修复竞争条件下 Schema.getIndexLabel 获取不到数据的问题(hugegraph #1629)</li><li>修复 HugeVertex4Insert 无法系列化问题(hugegraph #1630)</li><li>修复 MySQL count Statement 未关闭问题(hugegraph #1640)</li><li>修复当删除 Index Label 异常时,导致状态不同步问题(hugegraph #1642)</li><li>修复 MySQL 执行 gremlin timeout 导致的 statement 未关闭问题(hugegraph #1643)</li><li>改进 Search Index 以兼容特殊 Unicode 字符:\u0000 to \u0003(hugegraph #1659)</li><li>修复 #1659 引入的 Char 未转化为 String 的问题(hugegraph #1664)</li><li>修复 has() + within() 查询时结果异常问题(hugegraph #1680)</li><li>升级 Log4j 版本到 2.17 以修复安全漏洞(hugegraph #1686 #1698 #1702)</li><li>修复 HBase 后端 shard scan 中 startkey 包含空串时 NPE 问题(hugegraph #1691)</li><li>修复 paths 算法在深层环路遍历时性能下降问题(hugegraph #1694)</li><li>改进 personalrank 算法的参数默认值及错误检查(hugegraph #1695)</li><li>修复 RESTful 接口 P.within 条件不生效问题(hugegraph #1704)</li><li>修复启用权限时无法动态创建图的问题(hugegraph #1708)</li></ul><h4 id=配置项修改>配置项修改:</h4><ul><li>共享 SSL 相关配置项命名(hugegraph #1260)</li><li>支持 RocksDB 配置项 rocksdb.level_compaction_dynamic_level_bytes(hugegraph #1262)</li><li>去除 RESFful Server 服务协议配置项 restserver.protocol,自动提取 URL 中的 Schema(hugegraph #1272)</li><li>增加 PostgreSQL 配置项 jdbc.postgresql.connect_database(hugegraph #1293)</li><li>增加针对顶点主键是否编码的配置项 vertex.encode_primary_key_number(hugegraph #1323)</li><li>增加针对聚合查询是否启用索引优化的配置项 query.optimize_aggregate_by_index(hugegraph #1549)</li><li>修改 cache_type 的默认值 l1 为 l2(hugegraph #1681)</li><li>增加 JDBC 强制重连配置项 jdbc.forced_auto_reconnect(hugegraph #1710)</li></ul><h4 id=其它修改-1>其它修改</h4><ul><li>增加默认的 SSL Certificate 文件(hugegraph #1254)</li><li>OLTP 并行请求共享线程池,而非每个请求使用单独的线程池(hugegraph #1258)</li><li>修复 Example 的问题(hugegraph #1308)</li><li>使用 jraft 版本 1.3.5(hugegraph #1313)</li><li>如果启用了 Raft 模式时,关闭 RocksDB 的 WAL(hugegraph #1318)</li><li>使用 TarLz4Util 来提升快照 Snapshot 压缩的性能(hugegraph #1336)</li><li>升级存储的版本号(store version),因为 property key 增加了 read frequency(hugegraph #1341)</li><li>顶点/边 vertex/edge 的 Get API 使用 queryVertex/queryEdge 方法来替代 iterator 方法(hugegraph #1345)</li><li>支持 BFS 优化的多度查询(hugegraph #1359)</li><li>改进 RocksDB deleteRange() 带来的查询性能问题(hugegraph #1375)</li><li>修复 travis-ci cannot find symbol Namifiable 问题(hugegraph #1376)</li><li>确保 RocksDB 快照的磁盘与 data path 指定的一致(hugegraph #1392)</li><li>修复 MacOS 空闲内存 free_memory 计算不准确问题(hugegraph #1396)</li><li>增加 Raft onBusy 回调来配合限速(hugegraph #1401)</li><li>升级 netty-all 版本 4.1.13.Final 到 4.1.42.Final(hugegraph #1403)</li><li>支持 TaskScheduler 暂停当设置为 loading 模式时(hugegraph #1414)</li><li>修复 raft-tools 脚本的问题(hugegraph #1416)</li><li>修复 license params 问题(hugegraph #1420)</li><li>提升写权限日志的性能,通过 batch flush & async write 方式改进(hugegraph #1448)</li><li>增加 MySQL 连接 URL 的日志记录(hugegraph #1451)</li><li>提升用户信息校验性能(hugegraph# 1460)</li><li>修复 TTL 因为起始时间问题导致的错误(hugegraph #1478)</li><li>支持日志配置的热加载及对审计日志的压缩(hugegraph #1492)</li><li>支持针对用户级别的审计日志的限速(hugegraph #1493)</li><li>缓存 RamCache 支持用户自定义的过期时间(hugegraph #1494)</li><li>在 auth client 端缓存 login role 以避免重复的 RPC 调用(hugegraph #1507)</li><li>修复 IdSet.contains() 未复写 AbstractCollection.contains() 问题(hugegraph #1511)</li><li>修复当 commitPartOfEdgeDeletions() 失败时,未回滚 rollback 的问题(hugegraph #1513)</li><li>提升 Cache metrics 性能(hugegraph #1515)</li><li>当发生 license 操作错误时,增加打印异常日志(hugegraph #1522)</li><li>改进 SimilarsMap 实现(hugegraph #1523)</li><li>使用 tokenless 方式来更新 coverage(hugegraph #1529)</li><li>改进 project update 接口的代码(hugegraph #1537)</li><li>允许从 option() 访问 GRAPH_STORE(hugegraph #1546)</li><li>优化 kout/kneighbor 的 count 查询以避免拷贝集合(hugegraph #1550)</li><li>优化 shortestpath 遍历方式,以数据量少的一端优先遍历(hugegraph #1569)</li><li>完善 rocksdb.data_disks 配置项的 allowed keys 提示信息(hugegraph #1585)</li><li>为 number id 优化 OLTP 遍历中的 id2code 方法性能(hugegraph #1623)</li><li>优化 HugeElement.getProperties() 返回 Collection&lt;Property>(hugegraph #1624)</li><li>增加 APACHE PROPOSAL 文件(hugegraph #1644)</li><li>改进 close tx 的流程(hugegraph #1655)</li><li>当 reset() 时为 MySQL close 捕获所有类型异常(hugegraph #1661)</li><li>改进 OLAP property 模块代码(hugegraph #1675)</li><li>改进查询模块的执行性能(hugegraph #1711)</li></ul><h3 id=loader>Loader</h3><ul><li>支持导入 Parquet 格式文件(hugegraph-loader #174)</li><li>支持 HDFS Kerberos 权限验证(hugegraph-loader #176)</li><li>支持 HTTPS 协议连接到服务端导入数据(hugegraph-loader #183)</li><li>修复 trust store file 路径问题(hugegraph-loader #186)</li><li>处理 loading mode 重置的异常(hugegraph-loader #187)</li><li>增加在插入数据时对非空属性的检查(hugegraph-loader #190)</li><li>修复客户端与服务端时区不同导致的时间判断问题(hugegraph-loader #192)</li><li>优化数据解析性能(hugegraph-loader #194)</li><li>当用户指定了文件头时,检查其必须不为空(hugegraph-loader #195)</li><li>修复示例程序中 MySQL struct.json 格式问题(hugegraph-loader #198)</li><li>修复顶点边导入速度不精确的问题(hugegraph-loader #200 #205)</li><li>当导入启用 check-vertex 时,确保先导入顶点再导入边(hugegraph-loader #206)</li><li>修复边 Json 数据导入格式不统一时数组溢出的问题(hugegraph-loader #211)</li><li>修复因边 mapping 文件不存在导致的 NPE 问题(hugegraph-loader #213)</li><li>修复读取时间可能出现负数的问题(hugegraph-loader #215)</li><li>改进目录文件的日志打印(hugegraph-loader #223)</li><li>改进 loader 的的 Schema 处理流程(hugegraph-loader #230)</li></ul><h3 id=tools>Tools</h3><ul><li>支持 HTTPS 协议(hugegraph-tools #71)</li><li>移除 &ndash;protocol 参数,直接从 URL 中自动提取(hugegraph-tools #72)</li><li>支持将数据 dump 到 HDFS 文件系统(hugegraph-tools #73)</li><li>修复 trust store file 路径问题(hugegraph-tools #75)</li><li>支持权限信息的备份恢复(hugegraph-tools #76)</li><li>支持无参数的 Printer 打印(hugegraph-tools #79)</li><li>修复 MacOS free_memory 计算问题(hugegraph-tools #82)</li><li>支持备份恢复时指定线程数 hugegraph-tools #83)</li><li>支持动态创建图、克隆图、删除图等命令(hugegraph-tools #95)</li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-e45a1f0eaa721babce18f07eaf5fc437>10.2 - HugeGraph 1.0.0 Release Notes</h1><h3 id=oltp-api--client-更新>OLTP API & Client 更新</h3><h4 id=apiclient-接口更新>API/Client 接口更新</h4><ul><li>支持热更新<code>trace</code>开关的 <code>/exception/trace</code> API。</li><li>支持 Cypher 图查询语言 API。</li><li>支持通过 Swagger UI 接口来查看提供的 API 列表。</li><li>将各算法中 &rsquo;limit&rsquo; 参数的类型由 long 调整为 int。</li><li>支持在 Client 端跳过 Server 对 HBase 写入数据 (Beta)。</li></ul><h3 id=core--server>Core & Server</h3><h4 id=功能更新>功能更新</h4><ul><li>支持 Java 11 版本。</li><li>支持 2 个新的 OLTP 算法:adamic-adar 和 resource-allocation。</li><li>支持 HBase 后端使用哈希 RowKey,并且允许预初始化 HBase 表。</li><li>支持 Cypher 图查询语言。</li><li>支持集群 Master 角色的自动管理与故障转移。</li><li>支持 16 个 OLAP 算法,包括:LPA, Louvain, PageRank, BetweennessCentrality, RingsDetect 等。</li><li>根据 Apache 基金会对项目的发版要求进行适配,包括 License 合规性、发版流程、代码风格等,支持 Apache 版本发布。</li></ul><h4 id=bug-修复>Bug 修复</h4><ul><li>修复无法根据多个 Label 和属性来查询边数据。</li><li>增加对环路检测算法的最大深度限制。</li><li>修复 tree() 语句返回结果异常问题。</li><li>修复批量更新边传入 Id 时的检查异常问题。</li><li>解决非预期的 Task 状态问题。</li><li>解决在更新顶点时未清除边缓存的问题。</li><li>修复 MySQL 后端执行 g.V() 时的错误。</li><li>修复因为 server-info 无法超时导致的问题。</li><li>导出了 ConditionP 类型用于 Gremlin 中用户使用。</li><li>修复 within + Text.contains 查询问题。</li><li>修复 addIndexLabel/removeIndexLabel 接口的竞争条件问题。</li><li>限制仅 Admin 允许输出图实例。</li><li>修复 Profile API 的检查问题。</li><li>修复在 count().is(0) 查询中 Empty Graph 的问题。</li><li>修复在异常时无法关闭服务的问题。</li><li>修复在 Apple M1 系统上的 JNA 报错 UnsatisfiedLinkError 的问题。</li><li>修复启动 RpcServer 时报 NPE 的问题。</li><li>修复 ACTION_CLEARED 参数数量的问题。</li><li>修复 RpcServer 服务启动问题。</li><li>修复用户传入参数可能得数字转换隐患问题。</li><li>移除了 Word 分词器依赖。</li><li>修复 Cassandra 与 MySQL 后端在异常时未优雅关闭迭代器的问题。</li></ul><h4 id=配置项更新>配置项更新</h4><ul><li>将配置项 <code>raft.endpoint</code> 从 Graph 作用域移动到 Server 作用域中。</li></ul><h4 id=其它修改>其它修改</h4><ul><li>refact(core): enhance schema job module.</li><li>refact(raft): improve raft module & test & install snapshot and add peer.</li><li>refact(core): remove early cycle detection & limit max depth.</li><li>cache: fix assert node.next==empty.</li><li>fix apache license conflicts: jnr-posix and jboss-logging.</li><li>chore: add logo in README & remove outdated log4j version.</li><li>refact(core): improve CachedGraphTransaction perf.</li><li>chore: update CI config & support ci robot & add codeQL SEC-check & graph option.</li><li>refact: ignore security check api & fix some bugs & clean code.</li><li>doc: enhance CONTRIBUTING.md & README.md.</li><li>refact: add checkstyle plugin & clean/format the code.</li><li>refact(core): improve decode string empty bytes & avoid array-construct columns in BackendEntry.</li><li>refact(cassandra): translate ipv4 to ipv6 metrics & update cassandra dependency version.</li><li>chore: use .asf.yaml for apache workflow & replace APPLICATION_JSON with TEXT_PLAIN.</li><li>feat: add system schema store.</li><li>refact(rocksdb): update rocksdb version to 6.22 & improve rocksdb code.</li><li>refact: update mysql scope to test & clean protobuf style/configs.</li><li>chore: upgrade Dockerfile server to 0.12.0 & add editorconfig & improve ci.</li><li>chore: upgrade grpc version.</li><li>feat: support updateIfPresent/updateIfAbsent operation.</li><li>chore: modify abnormal logs & upgrade netty-all to 4.1.44.</li><li>refact: upgrade dependencies & adopt new analyzer & clean code.</li><li>chore: improve .gitignore & update ci configs & add RAT/flatten plugin.</li><li>chore(license): add dependencies-check ci & 3rd-party dependency licenses.</li><li>refact: Shutdown log when shutdown process & fix tx leak & enhance the file path.</li><li>refact: rename package to apache & dependency in all modules (Breaking Change).</li><li>chore: add license checker & update antrun plugin & fix building problem in windows.</li><li>feat: support one-step script for apache release v1.0.0 release.</li></ul><h3 id=computer-olap>Computer (OLAP)</h3><h4 id=algorithm-changes>Algorithm Changes</h4><ul><li>支持 PageRank 算法。</li><li>支持 WCC 算法。</li><li>支持 degree centrality 算法。</li><li>支持 triangle count 算法。</li><li>支持 rings detection 算法。</li><li>支持 LPA 算法。</li><li>支持 k-core 算法。</li><li>支持 closeness centrality 算法。</li><li>支持 betweenness centrality 算法。</li><li>支持 cluster coefficient 算法。</li></ul><h4 id=platform-changes>Platform Changes</h4><ul><li>feat: init module computer-core & computer-algorithm & etcd dependency.</li><li>feat: add Id as base type of vertex id.</li><li>feat: init Vertex/Edge/Properties & JsonStructGraphOutput.</li><li>feat: load data from hugegraph server.</li><li>feat: init basic combiner, Bsp4Worker, Bsp4Master.</li><li>feat: init sort & transport interface & basic FileInput/Output Stream.</li><li>feat: init computation & ComputerOutput/Driver interface.</li><li>feat: init Partitioner and HashPartitioner</li><li>feat: init Master/WorkerService module.</li><li>feat: init Heap/LoserTree sorting.</li><li>feat: init rpc module.</li><li>feat: init transport server, client, en/decode, flowControl, heartbeat.</li><li>feat: init DataDirManager & PointerCombiner.</li><li>feat: init aggregator module & add copy() and assign() methods to Value class.</li><li>feat: add startAsync and finishAsync on client side, add onStarted and onFinished on server side.</li><li>feat: init store/sort module.</li><li>feat: link managers in worker sending end.</li><li>feat: implement data receiver of worker.</li><li>feat: implement StreamGraphInput and EntryInput.</li><li>feat: add Sender and Receiver to process compute message.</li><li>feat: add seqfile fromat.</li><li>feat: add ComputeManager.</li><li>feat: add computer-k8s and computer-k8s-operator.</li><li>feat: add startup and make docker image code.</li><li>feat: sort different type of message use different combiner.</li><li>feat: add HDFS output format.</li><li>feat: mount config-map and secret to container.</li><li>feat: support java11.</li><li>feat: support partition concurrent compute.</li><li>refact: abstract computer-api from computer-core.</li><li>refact: optimize data receiving.</li><li>fix: release file descriptor after input and compute.</li><li>doc: add operator deploy readme.</li><li>feat: prepare for Apache release.</li></ul><h3 id=toolchain-loader-tools-hubble>Toolchain (loader, tools, hubble)</h3><ul><li>支持 Loader 使用 SQL 格式来选取从关系数据库导入哪些数据。</li><li>支持 Loader 从 Spark 导入数据(包括 JDBC 方式)。</li><li>支持 Loader 增加 Flink-CDC 模式。</li><li>解决 Loader 导入 ORC 格式数据时,报错 NPE。</li><li>解决 Loader 在 Spark/Flink 模式时未缓存 Schema 的问题。</li><li>解决 Loader 的 Json 反序列化问题。</li><li>解决 Loader 的 Jackson 版本冲突与依赖问题。</li><li>支持 Hubble 高级算法接口的 UI 界面。</li><li>支持 Hubble 中 Gremlin 语句的高亮格式显示。</li><li>支持 Hubble 使用 Docker 镜像部署。</li><li>支持 输出构建日志。</li><li>解决 Hubble 的端口输入框问题。</li><li>支持 Apache 项目发版的适配。</li></ul><h3 id=commons-commonrpc>Commons (common,rpc)</h3><ul><li>支持 assert-throws 方法返回 Future。</li><li>增加 Cnm 与 Anm 方法到 CollectionUtil 中。</li><li>支持 用户自定义的 content-type。</li><li>支持 Apache 项目发版的适配。</li></ul><h3 id=release-details>Release Details</h3><p>更加详细的版本变更信息,可以查看各个子仓库的链接:</p><ul><li><a href=https://github.com/apache/incubator-hugegraph/releases/tag/1.0.0>Server Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-toolchain/releases/tag/1.0.0>Toolchain Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-computer/releases/tag/1.0.0>Computer Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-commons/releases/tag/1.0.0>Commons Release Notes</a></li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-683dacb0fb9a0e0d70537cae5afdb7cf>10.3 - HugeGraph 1.2.0 Release Notes</h1><h3 id=java-version-statement>Java version statement</h3><blockquote><p>In the future, we will gradually upgrade the java version, <strong>Java 11</strong> -> <strong>Java 17</strong> -> <strong>Java 21</strong>.</p></blockquote><ol><li>Consider using Java 11 in hugegraph/hugegraph-toolchain/hugegraph-commons, also compatible with Java 8 now.</li><li>hugegraph-computer required to use Java 11, <strong>not compatible with Java 8 now!</strong></li></ol><p><strong>v1.2.0 是倒数第二个兼容 Java8 的大版本</strong>, 到 1.5.0 <a href=https://github.com/apache/incubator-hugegraph/issues/2265>PD/Store</a> 正式合入 master
后标志着 Java8 兼容的正式终结 (除 Client 外所有组件都将以 Java 11 作为基准,然后逐步迈向 Java17/21).</p><h3 id=hugegraph>hugegraph</h3><h4 id=api-changes>API Changes</h4><ul><li>feat(api&core): in oltp apis, add statistics info and support full info about vertices and edges (<a href=https://github.com/apache/incubator-hugegraph/pull/2262>#2262</a>)</li><li>feat(api): support embedded arthas agent in hugegraph-server (<a href=https://github.com/apache/incubator-hugegraph/pull/2278>#2278</a>,<a href=https://github.com/apache/incubator-hugegraph/pull/2337>#2337</a>)</li><li>feat(api): support metric API Prometheus format & add statistic metric api (<a href=https://github.com/apache/incubator-hugegraph/pull/2286>#2286</a>)</li><li>feat(api-core): support label & property filtering for both edge and vertex & support kout dfs mode (<a href=https://github.com/apache/incubator-hugegraph/pull/2295>#2295</a>)</li><li>feat(api): support recording slow query log (<a href=https://github.com/apache/incubator-hugegraph/pull/2327>#2327</a>)</li></ul><h4 id=feature-changes>Feature Changes</h4><ul><li>feat: support task auto manage by server role state machine (<a href=https://github.com/apache/incubator-hugegraph/pull/2130>#2130</a>)</li><li>feat: support parallel compress snapshot (<a href=https://github.com/apache/incubator-hugegraph/pull/2136>#2136</a>)</li><li>feat: use an enhanced CypherAPI to refactor it (<a href=https://github.com/apache/incubator-hugegraph/pull/2143>#2143</a>)</li><li>feat(perf): support JMH benchmark in HG-test module (<a href=https://github.com/apache/incubator-hugegraph/pull/2238>#2238</a>)</li><li>feat: optimising adjacency edge queries (<a href=https://github.com/apache/incubator-hugegraph/pull/2242>#2242</a>)</li><li>Feat: IP white list (<a href=https://github.com/apache/incubator-hugegraph/pull/2299>#2299</a>)</li><li>feat(cassandra): adapt cassandra from 3.11.12 to 4.0.10 (<a href=https://github.com/apache/incubator-hugegraph/pull/2300>#2300</a>)</li><li>feat: support Cassandra with docker-compose in server (<a href=https://github.com/apache/incubator-hugegraph/pull/2307>#2307</a>)</li><li>feat(core): support batch+parallel edges traverse (<a href=https://github.com/apache/incubator-hugegraph/pull/2312>#2312</a>)</li><li>feat: adapt Dockerfile for new project structur (<a href=https://github.com/apache/incubator-hugegraph/pull/2344>#2344</a>)</li><li>feat(server):swagger support auth for standardAuth mode by (<a href=https://github.com/apache/incubator-hugegraph/pull/2360>#2360</a>)</li><li>feat(core): add IntMapByDynamicHash V1 implement (<a href=https://github.com/apache/incubator-hugegraph/pull/2377>#2377</a>)</li></ul><h4 id=bug-fix>Bug Fix</h4><ul><li>fix: transfer add_peer/remove_peer command to leader (<a href=https://github.com/apache/incubator-hugegraph/pull/2112>#2112</a>)</li><li>fix query dirty edges of a vertex with cache (<a href=https://github.com/apache/incubator-hugegraph/pull/2166>#2166</a>)</li><li>fix exception of vertex-drop with index (<a href=https://github.com/apache/incubator-hugegraph/pull/2181>#2181</a>)</li><li>fix: remove dup &lsquo;From&rsquo; in filterExpiredResultFromFromBackend (<a href=https://github.com/apache/incubator-hugegraph/pull/2207>#2207</a>)</li><li>fix: jdbc ssl mode parameter redundant (<a href=https://github.com/apache/incubator-hugegraph/pull/2224>#2224</a>)</li><li>fix: error when start gremlin-console with sample script (<a href=https://github.com/apache/incubator-hugegraph/pull/2231>#2231</a>)</li><li>fix(core): support order by id (<a href=https://github.com/apache/incubator-hugegraph/pull/2233>#2233</a>)</li><li>fix: update ssl_mode value (<a href=https://github.com/apache/incubator-hugegraph/pull/2235>#2235</a>)</li><li>fix: optimizing ClassNotFoundException error message for MYSQL (<a href=https://github.com/apache/incubator-hugegraph/pull/2246>#2246</a>)</li><li>fix: asf invalid notification scheme &lsquo;discussions_status&rsquo; (<a href=https://github.com/apache/incubator-hugegraph/pull/2247>#2247</a>)</li><li>fix: asf invalid notification scheme &lsquo;discussions_comment&rsquo; (<a href=https://github.com/apache/incubator-hugegraph/pull/2250>#2250</a>)</li><li>fix: incorrect use of &lsquo;NO_LIMIT&rsquo; variable (<a href=https://github.com/apache/incubator-hugegraph/pull/2253>#2253</a>)</li><li>fix(core): close flat mapper iterator after usage (<a href=https://github.com/apache/incubator-hugegraph/pull/2281>#2281</a>)</li><li>fix(dist): avoid var PRELOAD cover environmnet vars (<a href=https://github.com/apache/incubator-hugegraph/pull/2302>#2302</a>)</li><li>fix: base-ref/head-ref missed in dependency-review on master (<a href=https://github.com/apache/incubator-hugegraph/pull/2308>#2308</a>)</li><li>fix(core): handle schema Cache expandCapacity concurrent problem (<a href=https://github.com/apache/incubator-hugegraph/pull/2332>#2332</a>)</li><li>fix: in wait-storage.sh, always wait for storage with default rocksdb (<a href=https://github.com/apache/incubator-hugegraph/pull/2333>#2333</a>)</li><li>fix(api): refactor/downgrade record logic for slow log (<a href=https://github.com/apache/incubator-hugegraph/pull/2347>#2347</a>)</li><li>fix(api): clean some code for release (<a href=https://github.com/apache/incubator-hugegraph/pull/2348>#2348</a>)</li><li>fix: remove redirect-to-master from synchronous Gremlin API (<a href=https://github.com/apache/incubator-hugegraph/pull/2356>#2356</a>)</li><li>fix HBase PrefixFilter bug (<a href=https://github.com/apache/incubator-hugegraph/pull/2364>#2364</a>)</li><li>chore: fix curl failed to request https urls (<a href=https://github.com/apache/incubator-hugegraph/pull/2378>#2378</a>)</li><li>fix(api): correct the vertex id in the edge-existence api (<a href=https://github.com/apache/incubator-hugegraph/pull/2380>#2380</a>)</li><li>fix: github action build docker image failed during the release 1.2 process (<a href=https://github.com/apache/incubator-hugegraph/pull/2386>#2386</a>)</li><li>fix: TinkerPop unit test lack some lables (<a href=https://github.com/apache/incubator-hugegraph/pull/2387>#2387</a>)</li></ul><h4 id=option-changes>Option Changes</h4><ul><li>feat(dist): support pre-load test graph data in docker container (<a href=https://github.com/apache/incubator-hugegraph/pull/2241>#2241</a>)</li></ul><h4 id=other-changes>Other Changes</h4><ul><li>refact: use standard UTF-8 charset & enhance CI configs (<a href=https://github.com/apache/incubator-hugegraph/pull/2095>#2095</a>)</li><li>move validate release to hugegraph-doc (<a href=https://github.com/apache/incubator-hugegraph/pull/2109>#2109</a>)</li><li>refact: use a slim way to build docker image on latest code & support zgc (<a href=https://github.com/apache/incubator-hugegraph/pull/2118>#2118</a>)</li><li>chore: remove stage-repo in pom due to release done & update mail rule (<a href=https://github.com/apache/incubator-hugegraph/pull/2128>#2128</a>)</li><li>doc: update issue template & README file (<a href=https://github.com/apache/incubator-hugegraph/pull/2131>#2131</a>)</li><li>chore: cmn algorithm optimization (<a href=https://github.com/apache/incubator-hugegraph/pull/2134>#2134</a>)</li><li>add github token for license check comment (<a href=https://github.com/apache/incubator-hugegraph/pull/2139>#2139</a>)</li><li>chore: disable PR up-to-date in branch (<a href=https://github.com/apache/incubator-hugegraph/pull/2150>#2150</a>)</li><li>refact(core): remove lock of globalMasterInfo to optimize perf (<a href=https://github.com/apache/incubator-hugegraph/pull/2151>#2151</a>)</li><li>chore: async remove left index shouldn&rsquo;t effect query (<a href=https://github.com/apache/incubator-hugegraph/pull/2199>#2199</a>)</li><li>refact(rocksdb): clean & reformat some code (<a href=https://github.com/apache/incubator-hugegraph/pull/2200>#2200</a>)</li><li>refact(core): optimized batch removal of remaining indices consumed by a single consumer (<a href=https://github.com/apache/incubator-hugegraph/pull/2203>#2203</a>)</li><li>add com.janeluo.ikkanalyzer dependency to core model (<a href=https://github.com/apache/incubator-hugegraph/pull/2206>#2206</a>)</li><li>refact(core): early stop unnecessary loops in edge cache (<a href=https://github.com/apache/incubator-hugegraph/pull/2211>#2211</a>)</li><li>doc: update README & add QR code (<a href=https://github.com/apache/incubator-hugegraph/pull/2218>#2218</a>)</li><li>chore: update .asf.yaml for mail rule (<a href=https://github.com/apache/incubator-hugegraph/pull/2221>#2221</a>)</li><li>chore: improve the UI & content in README (<a href=https://github.com/apache/incubator-hugegraph/pull/2227>#2227</a>)</li><li>chore: add pr template (<a href=https://github.com/apache/incubator-hugegraph/pull/2234>#2234</a>)</li><li>doc: modify ASF and remove meaningless CLA (<a href=https://github.com/apache/incubator-hugegraph/pull/2237>#2237</a>)</li><li>chore(dist): replace wget to curl to download swagger-ui (<a href=https://github.com/apache/incubator-hugegraph/pull/2277>#2277</a>)</li><li>Update StandardStateMachineCallback.java (<a href=https://github.com/apache/incubator-hugegraph/pull/2290>#2290</a>)</li><li>doc: update README about start server with example graph (<a href=https://github.com/apache/incubator-hugegraph/pull/2315>#2315</a>)</li><li>README.md tiny improve (<a href=https://github.com/apache/incubator-hugegraph/pull/2320>#2320</a>)</li><li>doc: README.md tiny improve (<a href=https://github.com/apache/incubator-hugegraph/pull/2331>#2331</a>)</li><li>refact: adjust project structure for merge PD & Store[Breaking Change] (<a href=https://github.com/apache/incubator-hugegraph/pull/2338>#2338</a>)</li><li>chore: disable raft test in normal PR due to timeout problem (<a href=https://github.com/apache/incubator-hugegraph/pull/2349>#2349</a>)</li><li>chore(ci): add stage profile settings (<a href=https://github.com/apache/incubator-hugegraph/pull/2361>#2361</a>)</li><li>refact(api): update common 1.2 & fix jersey client code problem (<a href=https://github.com/apache/incubator-hugegraph/pull/2365>#2365</a>)</li><li>chore: move server info into GlobalMasterInfo (<a href=https://github.com/apache/incubator-hugegraph/pull/2370>#2370</a>)</li><li>chore: reset hugegraph version to 1.2.0 (<a href=https://github.com/apache/incubator-hugegraph/pull/2382>#2382</a>)</li></ul><h3 id=hugegraph-computer>hugegraph-computer</h3><h4 id=feature-changes-1>Feature Changes</h4><ul><li>feat: implement fast-failover for MessageRecvManager and DataClientManager (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/243>#243</a>)</li><li>feat: implement parallel send data in load graph step (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/248>#248</a>)</li><li>feat(k8s): init operator project & add webhook (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/259>#259</a>, <a href=https://github.com/apache/incubator-hugegraph-computer/pull/263>#263</a>)</li><li>feat(core): support load vertex/edge snapshot (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/269>#269</a>)</li><li>feat(k8s): Add MinIO as internal(default) storage (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/272>#272</a>)</li><li>feat(algorithm): support random walk in computer (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/274>#274</a>, <a href=https://github.com/apache/incubator-hugegraph-computer/pull/280>#280</a>)</li><li>feat: use &lsquo;foreground&rsquo; delete policy to cancel k8s job (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/290>#290</a>)</li></ul><h4 id=bug-fix-1>Bug Fix</h4><ul><li>fix: superstep not take effect (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/237>#237</a>)</li><li>fix(k8s): modify inconsistent apiGroups (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/270>#270</a>)</li><li>fix(algorithm): record loop is not copied (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/276>#276</a>)</li><li>refact(core): adaptor for common 1.2 & fix a string of possible CI problem (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/286>#286</a>)</li><li>fix: remove okhttp1 due to conflicts risk (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/294>#294</a>)</li><li>fix(core): io.grpc.grpc-core dependency conflic (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/296>#296</a>)</li></ul><h4 id=option-changes-1>Option Changes</h4><ul><li>feat(core): isolate namespace for different input data source (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/252>#252</a>)</li><li>refact(core): support auth config for computer task (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/265>#265</a>)</li></ul><h4 id=other-changes-1>Other Changes</h4><ul><li>remove apache stage repo & update notification rule (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/232>#232</a>)</li><li>chore: fix empty license file (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/233>#233</a>)</li><li>chore: enhance mailbox settings & enable require ci (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/235>#235</a>)</li><li>fix: typo errors in start-computer.sh (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/238>#238</a>)</li><li>[Feature-241] Add PULL_REQUEST_TEMPLATE (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/242>#242</a>, <a href=https://github.com/apache/incubator-hugegraph-computer/pull/257>#257</a>)</li><li>chore: change etcd url only for ci (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/245>#245</a>)</li><li>doc: update readme & add QR code (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/249>#249</a>)</li><li>doc(k8s): add building note for missing classes (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/254>#254</a>)</li><li>chore: reduce mail to dev list (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/255>#255</a>)</li><li>add: dependency-review (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/266>#266</a>)</li><li>chore: correct incorrect comment (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/268>#268</a>)</li><li>refactor(api): ListValue.getFirst() replaces ListValue.get(0) (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/282>#282</a>)</li><li>Improve: Passing workerId to WorkerStat & Skip wait worker close if master executes failed (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/292>#292</a>)</li><li>chore: add check dependencies (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/293>#293</a>)</li><li>chore(license): update license for 1.2.0 (<a href=https://github.com/apache/incubator-hugegraph-computer/pull/299>#299</a>)</li></ul><h3 id=hugegraph-toolchain>hugegraph-toolchain</h3><h4 id=api-changes-1>API Changes</h4><ul><li>feat(client): support edgeExistence api (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/544>#544</a>)</li><li>refact(client): update tests for new OLTP traverser APIs (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/550>#550</a>)</li></ul><h4 id=feature-changes-2>Feature Changes</h4><ul><li>feat(spark): support spark-sink connector for loader (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/497>#497</a>)</li><li>feat(loader): support kafka as datasource (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/506>#506</a>)</li><li>feat(client): support go client for hugegraph (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/514>#514</a>)</li><li>feat(loader): support docker for loader (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/530>#530</a>)</li><li>feat: update common version and remove jersey code (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/538>#538</a>)</li></ul><h4 id=bug-fix-2>Bug Fix</h4><ul><li>fix: convert numbers to strings (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/465>#465</a>)</li><li>fix: hugegraph-spark-loader shell string length limit (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/469>#469</a>)</li><li>fix: spark loader meet Exception: Class is not registered (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/470>#470</a>)</li><li>fix: spark loader Task not serializable (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/471>#471</a>)</li><li>fix: spark with loader has dependency conflicts (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/480>#480</a>)</li><li>fix: spark-loader example schema and struct mismatch (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/504>#504</a>)</li><li>fix(loader): error log (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/499>#499</a>)</li><li>fix: checkstyle && add suppressions.xml (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/500>#500</a>)</li><li>fix(loader): resolve error in loader script (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/510>#510</a>)</li><li>fix: base-ref/head-ref missed in dependency-check-ci on branch push (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/516>#516</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/551>#551</a>)</li><li>fix yarn network connection on linux/arm64 arch (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/519>#519</a>)</li><li>fix(hubble): drop-down box could not display all options (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/535>#535</a>)</li><li>fix(hubble): build with node and yarn (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/543>#543</a>)</li><li>fix(loader): loader options (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/548>#548</a>)</li><li>fix(hubble): parent override children dep version (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/549>#549</a>)</li><li>fix: exclude okhttp1 which has different groupID with okhttp3 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/555>#555</a>)</li><li>fix: github action build docker image failed (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/556>#556</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/557>#557</a>)</li><li>fix: build error with npm not exist & tiny improve (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/558>#558</a>)</li></ul><h4 id=option-changes-2>Option Changes</h4><ul><li>set default data when create graph (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/447>#447</a>)</li></ul><h4 id=other-changes-2>Other Changes</h4><ul><li>chore: remove apache stage repo & update mail rule (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/433>#433</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/474>#474</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/479>#479</a>)</li><li>refact: clean extra store file in all modules (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/434>#434</a>)</li><li>chore: use fixed node.js version 16 to avoid ci problem (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/437>#437</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/441>#441</a>)</li><li>chore(hubble): use latest code in Dockerfile (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/440>#440</a>)</li><li>chore: remove maven plugin for docker build (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/443>#443</a>)</li><li>chore: improve spark parallel (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/450>#450</a>)</li><li>doc: fix build status badge link (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/455>#455</a>)</li><li>chore: keep hadoop-hdfs-client and hadoop-common version consistent (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/457>#457</a>)</li><li>doc: add basic contact info & QR code in README (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/462>#462</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/475>#475</a>)</li><li>chore: disable PR up-to-date in branch (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/473>#473</a>)</li><li>chore: auto add pr auto label by path (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/466>#466</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/528>#528</a>)</li><li>chore: unify the dependencies versions of the entire project (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/478>#478</a>)</li><li>chore(deps): bump async, semver, word-wrap, browserify-sign in hubble-fe (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/484>#484</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/491>#491</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/494>#494</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/529>#529</a>)</li><li>chore: add pr template (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/498>#498</a>)</li><li>doc(hubble): add docker-compose to start with server (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/522>#522</a>)</li><li>chore(ci): add stage profile settings (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/536>#536</a>)</li><li>chore(client): increase the api num as the latest server commit + 10 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/546>#546</a>)</li><li>chore(spark): install hugegraph from source (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/552>#552</a>)</li><li>doc: adjust docker related desc in readme (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/559>#559</a>)</li><li>chore(license): update license for 1.2 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/560>#560</a>, <a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/561>#561</a>)</li></ul><h3 id=hugegraph-commons>hugegraph-commons</h3><h4 id=feature-changes-3>Feature Changes</h4><ul><li>feat(common): replace jersey dependencies with OkHttp (Breaking Change) (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/133>#133</a>)</li></ul><h4 id=bug-fix-3>Bug Fix</h4><ul><li>fix(common): handle spring-boot2/jersey dependency conflicts (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/131>#131</a>)</li><li>fix: Assert.assertThrows() should check result of exceptionConsumer (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/135>#135</a>)</li><li>fix(common): json param convert (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/137>#137</a>)</li></ul><h4 id=other-changes-3>Other Changes</h4><ul><li>refact(common): add more construction methods for convenient (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/132>#132</a>)</li><li>add: dependency-review (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/134>#134</a>)</li><li>refact(common): rename jsonutil to avoid conflicts with server (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/136>#136</a>)</li><li>doc: update README for release (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/138>#138</a>)</li><li>update licence (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/139>#139</a>)</li></ul><h3 id=release-details>Release Details</h3><p>Please check the release details in each repository:</p><ul><li><a href=https://github.com/apache/incubator-hugegraph/releases>Server Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-toolchain/releases>Toolchain Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-computer/releases>Computer Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-commons/releases>Commons Release Notes</a></li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-cc8446bbcef27957e4ec28e70811ad2f>10.4 - HugeGraph 1.3.0 Release Notes</h1><h3 id=运行环境版本说明>运行环境/版本说明</h3><ol><li>优先在 <code>hugegraph/toolchain/commons</code>软件中使用 Java 11, 此次是这些模块最后一次主版本兼容 Java 8 了。(computer 则仅支持 Java11)</li><li>另外相比 Java11, 使用 Java8 会失去一些<strong>安全性</strong>的保障,我们推荐生产或对外网暴露访问的环境使用 Java11 并开启 <a href=/cn/docs/config/config-authentication/>Auth 权限认证</a></li></ol><p><strong>1.3.0</strong> 是最后兼容 <strong>Java 8</strong> 的版本,在下一个 1.5.0 版本发布 &ndash; <a href=https://github.com/apache/incubator-hugegraph/issues/2265>PD/Store</a> 合入主分支时就会全面使用 Java 11 (除<code>client</code>外).</p><p>PS: 未来 HugeGraph 组件的版本会朝着 <code>Java 11 -> Java 17 -> Java 21</code> 演进</p><blockquote><p>WIP: This doc is under construction, please wait for the final version (BETA)</p></blockquote><h3 id=hugegraph>hugegraph</h3><blockquote><p>在此次版本中我们修复了一些 SEC 相关的问题,如果是线上或者对外服务请升级到最新版本 + 开启权限认证</p></blockquote><h4 id=api-changes>API Changes</h4><ul><li>feat(api): optimize adjacent-edges query (<a href=https://github.com/apache/incubator-hugegraph/pull/2408>#2408</a>)</li></ul><h4 id=feature-changes>Feature Changes</h4><ul><li>feat: support docker use the auth when starting (<a href=https://github.com/apache/incubator-hugegraph/pull/2403>#2403</a>)</li><li>feat: added the OpenTelemetry trace support (<a href=https://github.com/apache/incubator-hugegraph/pull/2477>#2477</a>)</li></ul><h4 id=bug-fix>Bug Fix</h4><ul><li>fix(core): task restore interrupt problem on restart server (<a href=https://github.com/apache/incubator-hugegraph/pull/2401>#2401</a>)</li><li>fix(server): reinitialize the progress to set up graph auth friendly (<a href=https://github.com/apache/incubator-hugegraph/pull/2411>#2411</a>)</li><li>fix(chore): remove zgc in dockerfile for ARM env (<a href=https://github.com/apache/incubator-hugegraph/pull/2421>#2421</a>)</li><li>fix(server): make CacheManager constructor private to satisfy the singleton pattern (<a href=https://github.com/apache/incubator-hugegraph/pull/2432>#2432</a>)</li><li>fix(server): unify the license headers (<a href=https://github.com/apache/incubator-hugegraph/pull/2438>#2438</a>)</li><li>fix: format and clean code in dist and example modules (<a href=https://github.com/apache/incubator-hugegraph/pull/2441>#2441</a>)</li><li>fix: format and clean code in core module (<a href=https://github.com/apache/incubator-hugegraph/pull/2440>#2440</a>)</li><li>fix: format and clean code in modules (<a href=https://github.com/apache/incubator-hugegraph/pull/2439>#2439</a>)</li><li>fix(server): clean up the code (<a href=https://github.com/apache/incubator-hugegraph/pull/2456>#2456</a>)</li><li>fix(server): remove extra blank lines (<a href=https://github.com/apache/incubator-hugegraph/pull/2459>#2459</a>)</li><li>fix(server): add tip for gremlin api NPE with an empty query (<a href=https://github.com/apache/incubator-hugegraph/pull/2467>#2467</a>)</li><li>fix(server): fix the metric name when promthus collects hugegraph metric, see issue (<a href=https://github.com/apache/incubator-hugegraph/pull/2462>#2462</a>)</li><li>fix(server): <code>serverStarted</code> error when execute gremlin example (<a href=https://github.com/apache/incubator-hugegraph/pull/2473>#2473</a>)</li><li>fix(auth): enhance the URL check (<a href=https://github.com/apache/incubator-hugegraph/pull/2422>#2422</a>)</li></ul><h4 id=option-changes>Option Changes</h4><ul><li>refact(server): enhance the storage path in RocksDB & clean code (<a href=https://github.com/apache/incubator-hugegraph/pull/2491>#2491</a>)</li></ul><h4 id=other-changes>Other Changes</h4><ul><li>chore: add a license link (<a href=https://github.com/apache/incubator-hugegraph/pull/2398>#2398</a>)</li><li>doc: enhance NOTICE info to keep it clear (<a href=https://github.com/apache/incubator-hugegraph/pull/2409>#2409</a>)</li><li>chore(server): update swagger info for default server profile (<a href=https://github.com/apache/incubator-hugegraph/pull/2423>#2423</a>)</li><li>fix(server): unify license header for protobuf file (<a href=https://github.com/apache/incubator-hugegraph/pull/2448>#2448</a>)</li><li>chore: improve license header checker confs and pre-check header when validating (<a href=https://github.com/apache/incubator-hugegraph/pull/2445>#2445</a>)</li><li>chore: unify to call SchemaLabel.getLabelId() (<a href=https://github.com/apache/incubator-hugegraph/pull/2458>#2458</a>)</li><li>chore: refine the hg-style.xml specification (<a href=https://github.com/apache/incubator-hugegraph/pull/2457>#2457</a>)</li><li>chore: Add a newline formatting configuration and a comment for warning (<a href=https://github.com/apache/incubator-hugegraph/pull/2464>#2464</a>)</li><li>chore(server): clear context after req done (<a href=https://github.com/apache/incubator-hugegraph/pull/2470>#2470</a>)</li></ul><h3 id=hugegraph-toolchain>hugegraph-toolchain</h3><h4 id=api-changes-1>API Changes</h4><h4 id=feature-changes-1>Feature Changes</h4><ul><li>fix(loader): update shade plugin for spark loader (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/566>#566</a>)</li><li>fix(hubble): yarn install timeout in arm64 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/583>#583</a>)</li><li>fix(loader): support file name with prefix for hdfs source (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/571>#571</a>)</li><li>feat(hubble): warp the exception info in HugeClientUtil (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/589>#589</a>)</li></ul><h4 id=bug-fix-1>Bug Fix</h4><ul><li>fix: concurrency issue causing file overwrite due to identical filenames (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/572>#572</a>)</li></ul><h4 id=option-changes-1>Option Changes</h4><ul><li>feat(client): support user defined OKHTTPClient configs (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/590>#590</a>)</li></ul><h4 id=other-changes-1>Other Changes</h4><ul><li>doc: update copyright date(year) in NOTICE (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/567>#567</a>)</li><li>chore(deps): bump ip from 1.1.5 to 1.1.9 in /hugegraph-hubble/hubble-fe (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/580>#580</a>)</li><li>refactor(hubble): enhance maven front plugin (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/568>#568</a>)</li><li>chore(deps): bump es5-ext from 0.10.53 to 0.10.63 in /hugegraph-hubble/hubble-fe (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/582>#582</a>)</li><li>chore(hubble): Enhance code style in hubble (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/592>#592</a>)</li><li>chore: upgrade version to 1.3.0 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/596>#596</a>)</li><li>chore(ci): update profile commit id for 1.3 (<a href=https://github.com/apache/incubator-hugegraph-toolchain/pull/597>#597</a>)</li></ul><h3 id=hugegraph-commons>hugegraph-commons</h3><h4 id=feature-changes-2>Feature Changes</h4><ul><li>feat: support user defined RestClientConfig/HTTPClient params (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/140>#140</a>)</li></ul><h4 id=bug-fix-2>Bug Fix</h4><h4 id=other-changes-2>Other Changes</h4><ul><li>chore: disable clean flatten for deploy (<a href=https://github.com/apache/incubator-hugegraph-commons/pull/141>#141</a>)</li></ul><h3 id=release-details>Release Details</h3><h3 id=hugegraph-ai>hugegraph-ai</h3><p>这是 hugegraph-ai 的第一个发布版本,包含了多种特性,其中包括初始化的 Python 客户端、通过 LLM 构建知识图谱的能力,
以及基于 HugeGraph 的 RAG(Retrieval-Augmented Generation)集成。此外,该版本还在 python 客户端方面增加了重要的功能,
如变量 API、认证(auth)、度量(metric)、遍历器(traverser)和任务 API,以及使用 Gradio 创建交互式和可视化的演示。</p><p>除了这些新功能外,该版本还解决了多个错误和问题,确保了更加稳定和无误的用户体验。维护任务,如依赖更新、项目结构改进以及基本持续集成(CI)的添加,
进一步增强了项目的健壮性和开发工作流程。</p><blockquote><p>这个版本的发布凝聚了 HugeGraph 社区的协作努力,感谢各位贡献者的付出。</p></blockquote><h4 id=feature-changes-3>Feature Changes</h4><ul><li>feat: initialize hugegraph python client (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/5>#5</a>)</li><li>feat(llm): knowledge graph construction by llm (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/7>#7</a>)</li><li>feat: initialize rag based on HugeGraph (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/20>#20</a>)</li><li>feat(client): add variables api and test (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/24>#24</a>)</li><li>feat: add llm wenxinyiyan & config util & spo_triple_extract (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/27>#27</a>)</li><li>feat: add auth&metric&traverser&task api and ut (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/28>#28</a>)</li><li>feat: refactor construct knowledge graph task (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/29>#29</a>)</li><li>feat: Introduce gradio for creating interactive and visual demo (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/30>#30</a>)</li></ul><h4 id=bug-fix-3>Bug Fix</h4><ul><li>fix: invalid GitHub label (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/3>#3</a>)</li><li>fix: import error (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/13>#13</a>)</li><li>fix: function getEdgeByPage(): the generated query url does not include the parameter page (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/15>#15</a>)</li><li>fix: issue template (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/23>#23</a>)</li><li>fix: base-ref/head-ref missed in dependency-check-ci on branch push (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/25>#25</a>)</li></ul><h4 id=other-changes-3>Other Changes</h4><ul><li>chore: add asf.yaml and ISSUE_TEMPLATE (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/1>#1</a>)</li><li>Bump urllib3 from 2.0.3 to 2.0.7 in /hugegraph-python (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/8>#8</a>)</li><li>chore: create .gitignore file for py (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/9>#9</a>)</li><li>refact: improve project structure & add some basic CI (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/17>#17</a>)</li><li>chore: Update LICENSE and NOTICE (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/31>#31</a>)</li><li>chore: add release scripts (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/33>#33</a>)</li><li>chore: change file chmod 755 (<a href=https://github.com/apache/incubator-hugegraph-ai/pull/34>#34</a>)</li></ul><p>Please check the release details/contributor in each repository:</p><ul><li><a href=https://github.com/apache/incubator-hugegraph/releases>Server Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-toolchain/releases>Toolchain Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-ai/releases>AI Release Notes</a></li><li><a href=https://github.com/apache/incubator-hugegraph-commons/releases>Commons Release Notes</a></li></ul></div><div class=td-content style=page-break-before:always><h1 id=pg-01c617939d9e21dc19567e8753d6fd3b>11 -</h1><h2 id=contributor-agreement>Contributor Agreement</h2><h2 id=individual-contributor-exclusive-license-agreement>Individual Contributor exclusive License Agreement</h2><h2 id=including-the-traditional-patent-license-option>(including the TRADITIONAL PATENT LICENSE OPTION)</h2><p>Thank you for your interest in contributing to HugeGraph&rsquo;s all projects (&ldquo;We&rdquo; or &ldquo;Us&rdquo;).</p><p>The purpose of this contributor agreement (&ldquo;Agreement&rdquo;) is to clarify and document the rights granted by contributors to Us. To make this document effective, please follow the comment of GitHub CLA-Assistant when submitting a new pull request.</p><h3 id=how-to-use-this-contributor-agreement>How to use this Contributor Agreement</h3><p>If You are an employee and have created the Contribution as part of your employment, You need to have Your employer approve this Agreement or sign the Entity version of this document. If You do not own the Copyright in the entire work of authorship, any other author of the Contribution should also sign this – in any event, please contact Us at <a href=mailto:hugegraph@googlegroups.com>hugegraph@googlegroups.com</a></p><h3 id=1-definitions>1. Definitions</h3><p><strong>&ldquo;You&rdquo;</strong> means the individual Copyright owner who Submits a Contribution to Us.</p><p><strong>&ldquo;Contribution&rdquo;</strong> means any original work of authorship, including any original modifications or additions to an existing work of authorship, Submitted by You to Us, in which You own the Copyright.</p><p><strong>&ldquo;Copyright&rdquo;</strong> means all rights protecting works of authorship, including copyright, moral and neighboring rights, as appropriate, for the full term of their existence.</p><p><strong>&ldquo;Material&rdquo;</strong> means the software or documentation made available by Us to third parties. When this Agreement covers more than one software project, the Material means the software or documentation to which the Contribution was Submitted. After You Submit the Contribution, it may be included in the Material.</p><p><strong>&ldquo;Submit&rdquo;</strong> means any act by which a Contribution is transferred to Us by You by means of tangible or intangible media, including but not limited to electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Us, but excluding any transfer that is conspicuously marked or otherwise designated in writing by You as &ldquo;Not a Contribution.&rdquo;</p><p><strong>&ldquo;Documentation&rdquo;</strong> means any non-software portion of a Contribution.</p><h3 id=2-license-grant>2. License grant</h3><h4 id=21-copyright-license-to-us>2.1 Copyright license to Us</h4><p>Subject to the terms and conditions of this Agreement, You hereby grant to Us a worldwide, royalty-free, Exclusive, perpetual and irrevocable (except as stated in Section 8.2) license, with the right to transfer an unlimited number of non-exclusive licenses or to grant sublicenses to third parties, under the Copyright covering the Contribution to use the Contribution by all means, including, but not limited to:</p><ul><li>publish the Contribution,</li><li>modify the Contribution,</li><li>prepare derivative works based upon or containing the Contribution and/or to combine the Contribution with other Materials,</li><li>reproduce the Contribution in original or modified form,</li><li>distribute, to make the Contribution available to the public, display and publicly perform the Contribution in original or modified form.</li></ul><h4 id=22-moral-rights>2.2 Moral rights</h4><p>Moral Rights remain unaffected to the extent they are recognized and not waivable by applicable law. Notwithstanding, You may add your name to the attribution mechanism customary used in the Materials you Contribute to, such as the header of the source code files of Your Contribution, and We will respect this attribution when using Your Contribution.</p><h4 id=23-copyright-license-back-to-you>2.3 Copyright license back to You</h4><p>Upon such grant of rights to Us, We immediately grant to You a worldwide, royalty-free, non-exclusive, perpetual and irrevocable license, with the right to transfer an unlimited number of non-exclusive licenses or to grant sublicenses to third parties, under the Copyright covering the Contribution to use the Contribution by all means, including, but not limited to:</p><ul><li>publish the Contribution,</li><li>modify the Contribution,</li><li>prepare derivative works based upon or containing the Contribution and/or to combine the Contribution with other Materials,</li><li>reproduce the Contribution in original or modified form,</li><li>distribute, to make the Contribution available to the public, display and publicly perform the Contribution in original or modified form.</li></ul><p>This license back is limited to the Contribution and does not provide any rights to the Material.</p><h3 id=3-patents>3. Patents</h3><h4 id=31-patent-license>3.1 Patent license</h4><p>Subject to the terms and conditions of this Agreement You hereby grant to Us and to recipients of Materials distributed by Us a worldwide, royalty-free, non-exclusive, perpetual and irrevocable (except as stated in Section 3.2) patent license, with the right to transfer an unlimited number of non-exclusive licenses or to grant sublicenses to third parties, to make, have made, use, sell, offer for sale, import and otherwise transfer the Contribution and the Contribution in combination with any Material (and portions of such combination). This license applies to all patents owned or controlled by You, whether already acquired or hereafter acquired, that would be infringed by making, having made, using, selling, offering for sale, importing or otherwise transferring of Your Contribution(s) alone or by combination of Your Contribution(s) with any Material.</p><h4 id=32-revocation-of-patent-license>3.2 Revocation of patent license</h4><p>You reserve the right to revoke the patent license stated in section 3.1 if We make any infringement claim that is targeted at your Contribution and not asserted for a Defensive Purpose. An assertion of claims of the Patents shall be considered for a &ldquo;Defensive Purpose&rdquo; if the claims are asserted against an entity that has filed, maintained, threatened, or voluntarily participated in a patent infringement lawsuit against Us or any of Our licensees.</p><h3 id=4-license-obligations-by-us>4. License obligations by Us</h3><p>We agree to (sub)license the Contribution or any Materials containing, based on or derived from your Contribution under the terms of any licenses the Free Software Foundation classifies as Free Software License and which are approved by the Open Source Initiative as Open Source licenses.</p><p>More specifically and in strict accordance with the above paragraph, we agree to (sub)license the Contribution or any Materials containing, based on or derived from the Contribution only in accordance with our licensing policy available at: <a href=http://www.apache.org/licenses/LICENSE-2.0>http://www.apache.org/licenses/LICENSE-2.0</a>.</p><p>In addition, We may use the following licenses for Documentation in the Contribution: GFDL-1.2 (including any right to adopt any future version of a license).</p><p>We agree to license patents owned or controlled by You only to the extent necessary to (sub)license Your Contribution(s) and the combination of Your Contribution(s) with the Material under the terms of any licenses the Free Software Foundation classifies as Free Software licenses and which are approved by the Open Source Initiative as Open Source licenses..</p><h3 id=5-disclaimer>5. Disclaimer</h3><p>THE CONTRIBUTION IS PROVIDED &ldquo;AS IS&rdquo;. MORE PARTICULARLY, ALL EXPRESS OR IMPLIED WARRANTIES INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US AND BY US TO YOU. TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED, SUCH WARRANTY IS LIMITED IN DURATION AND EXTENT TO THE MINIMUM PERIOD AND EXTENT PERMITTED BY LAW.</p><h3 id=6-consequential-damage-waiver>6. Consequential damage waiver</h3><p>TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL YOU OR WE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF ANTICIPATED SAVINGS, LOSS OF DATA, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL AND EXEMPLARY DAMAGES ARISING OUT OF THIS AGREEMENT REGARDLESS OF THE LEGAL OR EQUITABLE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS BASED.</p><h3 id=7-approximation-of-disclaimer-and-damage-waiver>7. Approximation of disclaimer and damage waiver</h3><p>IF THE DISCLAIMER AND DAMAGE WAIVER MENTIONED IN SECTION 5. AND SECTION 6. CANNOT BE GIVEN LEGAL EFFECT UNDER APPLICABLE LOCAL LAW, REVIEWING COURTS SHALL APPLY LOCAL LAW THAT MOST CLOSELY APPROXIMATES AN ABSOLUTE WAIVER OF ALL CIVIL OR CONTRACTUAL LIABILITY IN CONNECTION WITH THE CONTRIBUTION.</p><h3 id=8-term>8. Term</h3><p>8.1 This Agreement shall come into effect upon Your acceptance of the terms and conditions.</p><p>8.2 This Agreement shall apply for the term of the copyright and patents licensed here. However, You shall have the right to terminate the Agreement if We do not fulfill the obligations as set forth in Section 4. Such termination must be made in writing.</p><p>8.3 In the event of a termination of this Agreement Sections 5, 6, 7, 8 and 9 shall survive such termination and shall remain in full force thereafter. For the avoidance of doubt, Free and Open Source Software (sub)licenses that have already been granted for Contributions at the date of the termination shall remain in full force after the termination of this Agreement.</p><h3 id=9-miscellaneous>9 Miscellaneous</h3><p>9.1 This Agreement and all disputes, claims, actions, suits or other proceedings arising out of this agreement or relating in any way to it shall be governed by the laws of China excluding its private international law provisions.</p><p>9.2 This Agreement sets out the entire agreement between You and Us for Your Contributions to Us and overrides all other agreements or understandings.</p><p>9.3 In case of Your death, this agreement shall continue with Your heirs. In case of more than one heir, all heirs must exercise their rights through a commonly authorized person.</p><p>9.4 If any provision of this Agreement is found void and unenforceable, such provision will be replaced to the extent possible with a provision that comes closest to the meaning of the original provision and that is enforceable. The terms and conditions set forth in this Agreement shall apply notwithstanding any failure of essential purpose of this Agreement or any limited remedy to the maximum extent possible under law.</p><p>9.5 You agree to notify Us of any facts or circumstances of which you become aware that would make this Agreement inaccurate in any respect.</p></div><div class=td-content style=page-break-before:always><h1 id=pg-a395eab4dc054c73b0174216cfbeaf1a>12 -</h1><h1 id=hugegraph-docs>HugeGraph Docs</h1><ul><li><a href=download.md>Download</a></li></ul><h2 id=quickstart>Quickstart</h2><ul><li><a href=quickstart/hugegraph-server.md>Install HugeGraph-Server</a></li><li><a href=quickstart/hugegraph-loader.md>Load data with HugeGraph-Loader</a></li><li><a href=quickstart/hugegraph-hubble.md>Visual with HugeGraph-Hubble</a></li><li><a href=quickstart/hugegraph-client.md>Develop with HugeGraph-Client</a></li><li><a href=quickstart/hugegraph-tools.md>Manage with HugeGraph-Tools</a></li><li><a href=quickstart/hugegraph-computer.md>Analysis with HugeGraph-Computer</a></li><li><a href=quickstart/hugegraph-studio.md>Display with HugeGraph-Studio</a></li></ul><h2 id=config>Config</h2><ul><li><a href=config/config-guide.md>Config Guide</a></li><li><a href=config/config-option.md>Config Options</a></li><li><a href=config/config-authentication.md>Config Authentication</a></li><li><a href=config/config-https.md>Config HTTPS</a></li><li><a href=config/config-computer.md>Config Computer</a></li></ul><h2 id=api>API</h2><ul><li><a href=clients/hugegraph-api.md>RESTful API</a><ul><li><a href=clients/restful-api/schema.md>Schema</a></li><li><a href=clients/restful-api/propertykey.md>PropertyKey</a></li><li><a href=clients/restful-api/vertexlabel.md>VertexLabel</a></li><li><a href=clients/restful-api/edgelabel.md>EdgeLabel</a></li><li><a href=clients/restful-api/indexlabel.md>IndexLabel</a></li><li><a href=clients/restful-api/rebuild.md>Rebuild</a></li><li><a href=clients/restful-api/vertex.md>Vertex</a></li><li><a href=clients/restful-api/edge.md>Edge</a></li><li><a href=clients/restful-api/traverser.md>Traverser</a></li><li><a href=clients/restful-api/rank.md>Rank</a></li><li><a href=clients/restful-api/variable.md>Variable</a></li><li><a href=clients/restful-api/graphs.md>Graphs</a></li><li><a href=clients/restful-api/task.md>Task</a></li><li><a href=clients/restful-api/gremlin.md>Gremlin</a></li><li><a href=clients/restful-api/cypher.md>Cypher</a></li><li><a href=clients/restful-api/auth.md>Authentication</a></li><li><a href=clients/restful-api/other.md>Other</a></li></ul></li><li><a href=clients/hugegraph-client.md>Java Client</a></li><li><a href=clients/gremlin-console.md>Gremlin Console</a></li></ul><h2 id=guides>Guides</h2><ul><li><a href=guides/architectural.md>Architecture Overview</a></li><li><a href=guides/desgin-concept.md>Design Concepts</a></li><li><a href=guides/custom-plugin.md>Custom Plugins</a></li><li><a href=guides/backup-restore.md>Backup Restore</a></li><li><a href=guides/faq.md>FAQ</a></li></ul><h2 id=query-language>Query Language</h2><ul><li><a href=language/hugegraph-gremlin.md>Gremlin Query Language</a></li><li><a href=language/hugegraph-example.md>HugeGraph Examples</a></li></ul><h2 id=performance>Performance</h2><ul><li><a href=performance/hugegraph-benchmark-0.5.6.md>HugeGraph Benchmark Performance</a></li><li><a href=content/cn/docs/performance/api-preformance/_index.md>HugeGraph API Performance-Outdated</a><ul><li><a href=content/cn/docs/performance/api-preformance/hugegraph-api-0.5.6-RocksDB.md>v0.5.6 Stand-alone(RocksDB)</a></li><li><a href=content/cn/docs/performance/api-preformance/hugegraph-api-0.5.6-Cassandra.md>v0.5.6 Cluster(Cassandra)</a></li><li><a href=content/cn/docs/performance/api-preformance/hugegraph-api-0.4.4.md>v0.4.4</a></li><li><a href=content/cn/docs/performance/api-preformance/hugegraph-api-0.2.md>v0.2</a></li></ul></li><li><a href=performance/hugegraph-loader-performance.md>HugeGraph-Loader Performance</a></li></ul><h2 id=changelogs>ChangeLogs</h2><ul><li><a href=changelog/hugegraph-1.3.0-release-notes.md>Release-1.3.0</a></li><li><a href=changelog/hugegraph-1.2.0-release-notes.md>Release-1.2.0</a></li><li><a href=changelog/hugegraph-1.0.0-release-notes.md>Release-1.0.0</a></li></ul><hr><ul><li><a href=changelog/hugegraph-0.12.0-release-notes.md>Release-0.12.0</a></li><li><a href=changelog/hugegraph-0.11.2-release-notes.md>Release-0.11.2</a></li><li><a href=changelog/hugegraph-0.10.4-release-notes.md>Release-0.10.4</a></li><li><a href=changelog/hugegraph-0.9.2-release-notes.md>Release-0.9.2</a></li><li><a href=changelog/hugegraph-0.8.0-release-notes.md>Release-0.8.0</a></li><li><a href=changelog/hugegraph-0.7.4-release-notes.md>Release-0.7.4</a></li><li><a href=changelog/hugegraph-0.6.1-release-notes.md>Release-0.6.1</a></li><li><a href=changelog/hugegraph-0.5.6-release-notes.md>Release-0.5.6</a></li><li><a href=changelog/hugegraph-0.4.4-release-notes.md>Release-0.4.4</a></li><li><a href=changelog/hugegraph-0.3.3-release-notes.md>Release-0.3.3</a></li><li><a href=changelog/hugegraph-0.2.4-release-notes.md>Release-0.2.4</a></li><li><a href=changelog/hugegraph-0.2-release-notes.md>Release-0.2</a></li></ul></div></main></div></div><footer class="bg-dark py-3 row d-print-none"><div class=footer-container><div class="row bg-dark"><div class=col-1></div><div class="col-4 text-center container-center"><div class=footer-row><a href=https://www.apache.org><div class=footer-apache-logo><svg id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 7127.6 2890" enable-background="new 0 0 7127.6 2890"><path fill="#6d6e71" d="M7104.7 847.8c15.3 15.3 22.9 33.7 22.9 55.2s-7.6 39.9-22.9 55.4c-15.3 15.4-33.8 23.1-55.6 23.1s-40.2-7.6-55.4-22.9c-15.1-15.3-22.7-33.7-22.7-55.2s7.6-39.9 22.9-55.4c15.3-15.4 33.7-23.1 55.4-23.1C7070.9 824.9 7089.4 832.5 7104.7 847.8zM7098.1 951.9c13.3-13.6 20-29.8 20-48.7s-6.6-35-19.8-48.5c-13.2-13.4-29.4-20.1-48.6-20.1-19.2.0-35.4 6.7-48.7 20.2s-19.9 29.7-19.9 48.7 6.6 35.2 19.7 48.6c13.1 13.4 29.3 20.1 48.5 20.1S7084.7 965.4 7098.1 951.9zm-11-63.8c0 14-6.1 22.8-18.4 26.4l22.5 30.5H7073l-20.3-28.3h-18.6V945h-14.7v-84.6h31.8c12.8.0 22 2.2 27.6 6.6C7084.4 871.4 7087.1 878.4 7087.1 888.1zM7068.2 9e2c3-2.4 4.4-6.5 4.4-12s-1.5-9.4-4.5-11.6-8.4-3.2-16-3.2h-18v30.5h17.5C7059.7 903.6 7065.3 902.4 7068.2 9e2z"/><path fill="#6d6e71" d="M1803.6 499.8v155.4h-20V499.8h-56.8v-19.2h133.9v19.2H1803.6z"/><path fill="#6d6e71" d="M2082.2 655.2v-76.9H1977v76.9h-20V480.5h20v78.9h105.2v-78.9h20v174.7h-20z"/><path fill="#6d6e71" d="M2241.4 499.8v57.4h88.1v19.2h-88.1v59.8h101.8v19h-121.8V480.5H2340v19.2H2241.4z"/><path fill="#d22128" d="M1574.5 1852.4l417.3-997.6h80.1l417.3 997.6h-105.4l-129.3-311.9h-448.2l-127.9 311.9H1574.5zM2032.6 970l-205.1 493.2h404.7L2032.6 970z"/><path fill="#d22128" d="M2596.9 1852.4V854.8H3010c171.4.0 295.1 158.8 295.1 313.3.0 163-115.2 316.1-286.6 316.1h-324.6v368.1h-97zm97-455.3h318.9c118 0 193.9-108.2 193.9-229 0-125.1-92.7-226.2-202.3-226.2h-310.5v455.2z"/><path fill="#d22128" d="M3250.5 1852.4l417.3-997.6h80.1l417.3 997.6h-105.4l-129.3-311.9h-448.2l-127.9 311.9H3250.5zM3708.6 970l-205.1 493.2h404.7L3708.6 970z"/><path fill="#d22128" d="M4637.3 849.1c177 0 306.3 89.9 368.1 217.8l-78.7 47.8c-63.2-132.1-186.9-177-295.1-177-238.9.0-369.5 213.6-369.5 414.5.0 220.6 161.6 420.1 373.7 420.1 112.4.0 244.5-56.2 307.7-185.5l81.5 42.1c-64.6 148.9-241.7 231.8-394.8 231.8-274 0-466.5-261.3-466.5-514.2C4163.8 1106.3 4336.6 849.1 4637.3 849.1z"/><path fill="#d22128" d="M5949.1 854.8v997.6h-98.4v-466.5h-591.5v466.5h-96.9V854.8h96.9v444h591.5v-444H5949.1z"/><path fill="#d22128" d="M6844.6 1765.2v87.1h-670.2V854.8H6832v87.1h-560.6v359.7h489v82.9h-489v380.8H6844.6z"/><path fill="#6d6e71" d="M1667.6 2063.6c11.8 3.5 22.2 8.3 31 14.2l-10.3 22.6c-9-6-18.6-10.4-28.9-13.4-10.2-2.9-20-4.4-29.2-4.4-13.6.0-24.5 2.4-32.6 7.3s-12.2 11.8-12.2 20.7c0 7.6 2.3 14 6.8 19s10.2 8.9 17 11.7c6.8 2.8 16.1 6 28 9.6 14.4 4.6 26 8.9 34.7 12.9 8.8 4 16.3 9.9 22.5 17.8 6.2 7.8 9.3 18.2 9.3 31 0 11.7-3.2 21.8-9.5 30.6-6.3 8.7-15.3 15.5-26.8 20.3-11.6 4.8-24.9 7.2-40 7.2s-29.7-2.9-43.9-8.7c-14.2-5.8-26.4-13.6-36.6-23.4l10.7-21.6c9.6 9.4 20.7 16.7 33.3 21.9 12.6 5.2 24.8 7.8 36.8 7.8 15.3.0 27.3-3 36.1-8.9s13.2-13.9 13.2-23.9c0-7.8-2.3-14.3-6.9-19.4-4.6-5.1-10.3-9-17.1-11.9-6.8-2.8-16.1-6-28-9.6-14.2-4.2-25.7-8.3-34.6-12.2-8.9-3.9-16.4-9.7-22.5-17.5-6.1-7.7-9.2-17.9-9.2-30.6.0-10.9 3-20.4 9-28.6s14.6-14.6 25.6-19.1c11.1-4.5 23.8-6.8 38.2-6.8C1643.8 2058.3 1655.7 2060.1 1667.6 2063.6z"/><path fill="#6d6e71" d="M1980.1 2072.8c16.8 9.4 30.2 22.3 40 38.4 9.8 16.2 14.8 33.9 14.8 53.3.0 19.5-4.9 37.4-14.8 53.6-9.8 16.3-23.2 29.1-40 38.6s-35.3 14.3-55.2 14.3c-20.3.0-38.8-4.7-55.7-14.3-16.8-9.5-30.2-22.4-40-38.6-9.8-16.3-14.8-34.1-14.8-53.6s4.9-37.3 14.8-53.5c9.8-16.2 23.2-29 40-38.3 16.8-9.4 35.4-14 55.7-14C1944.8 2058.6 1963.2 2063.3 1980.1 2072.8zM1881.9 2092.7c-13.1 7.4-23.6 17.5-31.4 30.1-7.8 12.6-11.8 26.5-11.8 41.7.0 15.3 3.9 29.3 11.8 42 7.8 12.7 18.3 22.8 31.4 30.2 13.1 7.4 27.4 11.1 42.9 11.1s29.7-3.7 42.7-11.1 23.3-17.4 31.1-30.2c7.7-12.7 11.6-26.7 11.6-42s-3.9-29.2-11.6-41.8c-7.7-12.6-18.1-22.6-31.1-30s-27.2-11.2-42.6-11.2C1909.4 2081.5 1895.1 2085.2 1881.9 2092.7z"/><path fill="#6d6e71" d="M2186.5 2082.4v74h98.4v23.2h-98.4v90.2h-24.1v-210.6h133.8v23.2H2186.5z"/><path fill="#6d6e71" d="M2491.6 2082.4v187.4h-24.1v-187.4h-68.4v-23.2h161.4v23.2H2491.6z"/><path fill="#6d6e71" d="M2871.8 2269.8l-56.8-177.4-57.6 177.4h-24.5l-70.5-210.6h25.9l57.9 182.7 57.1-182.4 24.1-.3 57.7 182.7 57.1-182.7h25l-70.6 210.6H2871.8z"/><path fill="#6d6e71" d="M3087.3 2216.6l-23.5 53.2h-25.6l94.4-210.6h25l94.1 210.6h-26.1l-23.5-53.2H3087.3zM3144.5 2086.6l-46.9 106.8h94.4l-47.5-106.8z"/><path fill="#6d6e71" d="M3461.1 2202.7c-6 .4-10.7.6-14.1.6h-56v66.5h-24v-210.6h80c26.2.0 46.6 6.2 61.2 18.5 14.5 12.3 21.8 29.8 21.8 52.3.0 17.2-4.1 31.7-12.2 43.3-8.1 11.6-19.8 20-35 25l49.2 71.5h-27.3L3461.1 2202.7zM3491.3 2167.6c10.3-8.4 15.5-20.8 15.5-37 0-15.9-5.2-27.9-15.5-36s-25.1-12.2-44.3-12.2h-56v97.8h56C3466.2 2180.2 3481 2176 3491.3 2167.6z"/><path fill="#6d6e71" d="M3688.3 2082.4v69.2h106.2v23.2h-106.2v72.1h122.8v22.9h-146.9v-210.6h142.9v23.2H3688.3z"/><path fill="#6d6e71" d="M4147 2082.4v74h98.4v23.2H4147v90.2h-24.1v-210.6h133.8v23.2H4147z"/><path fill="#6d6e71" d="M4523.3 2072.8c16.8 9.4 30.2 22.3 40 38.4 9.8 16.2 14.8 33.9 14.8 53.3.0 19.5-4.9 37.4-14.8 53.6-9.8 16.3-23.2 29.1-40 38.6s-35.3 14.3-55.2 14.3c-20.3.0-38.8-4.7-55.7-14.3-16.8-9.5-30.2-22.4-40-38.6-9.8-16.3-14.8-34.1-14.8-53.6s4.9-37.3 14.8-53.5c9.8-16.2 23.2-29 40-38.3 16.8-9.4 35.4-14 55.7-14C4488.1 2058.6 4506.5 2063.3 4523.3 2072.8zM4425.2 2092.7c-13.1 7.4-23.6 17.5-31.4 30.1-7.8 12.6-11.8 26.5-11.8 41.7.0 15.3 3.9 29.3 11.8 42 7.8 12.7 18.3 22.8 31.4 30.2 13.1 7.4 27.4 11.1 42.9 11.1s29.7-3.7 42.7-11.1 23.3-17.4 31.1-30.2c7.7-12.7 11.6-26.7 11.6-42s-3.9-29.2-11.6-41.8c-7.7-12.6-18.1-22.6-31.1-30s-27.2-11.2-42.6-11.2C4452.6 2081.5 4438.3 2085.2 4425.2 2092.7z"/><path fill="#6d6e71" d="M4854.7 2247.7c-15.7 15.5-37.3 23.3-64.8 23.3-27.7.0-49.4-7.8-65.1-23.3-15.7-15.5-23.6-37-23.6-64.6v-124h24.1v124c0 20.3 5.8 36.1 17.3 47.5 11.6 11.4 27.3 17.1 47.3 17.1 20.1.0 35.8-5.7 47.1-17 11.4-11.3 17-27.2 17-47.7v-124h24.1v124C4878.2 2210.7 4870.4 2232.2 4854.7 2247.7z"/><path fill="#6d6e71" d="M5169.5 2269.8l-126.3-169.1v169.1h-24.1v-210.6h25l126.3 169.3v-169.3h23.8v210.6H5169.5z"/><path fill="#6d6e71" d="M5478.4 2073.1c16.4 9.3 29.4 21.9 38.9 37.9 9.6 16 14.3 33.9 14.3 53.5s-4.8 37.6-14.3 53.6c-9.5 16.1-22.6 28.7-39.3 37.9-16.6 9.2-35.2 13.8-55.5 13.8h-84.3v-210.6h85.2C5443.7 2059.2 5462 2063.8 5478.4 2073.1zM5362.3 2246.9h61.4c15.5.0 29.6-3.5 42.3-10.6s22.8-16.9 30.2-29.5c7.4-12.5 11.1-26.5 11.1-42s-3.8-29.4-11.3-41.9-17.7-22.3-30.6-29.6c-12.8-7.2-27-10.9-42.6-10.9h-60.5v164.5z"/><path fill="#6d6e71" d="M5668.6 2216.6l-23.5 53.2h-25.6l94.4-210.6h25l94.1 210.6h-26l-23.5-53.2H5668.6zM5725.8 2086.6l-46.9 106.8h94.4l-47.5-106.8z"/><path fill="#6d6e71" d="M5991 2082.4v187.4h-24v-187.4h-68.4v-23.2H6060v23.2h-69z"/><path fill="#6d6e71" d="M6175.9 2269.8v-210.6h24.1v210.6H6175.9z"/><path fill="#6d6e71" d="M6493.7 2072.8c16.8 9.4 30.2 22.3 40 38.4 9.8 16.2 14.8 33.9 14.8 53.3.0 19.5-4.9 37.4-14.8 53.6-9.8 16.3-23.2 29.1-40 38.6s-35.3 14.3-55.2 14.3c-20.3.0-38.8-4.7-55.7-14.3-16.8-9.5-30.2-22.4-40-38.6-9.8-16.3-14.8-34.1-14.8-53.6s4.9-37.3 14.8-53.5c9.8-16.2 23.2-29 40-38.3 16.8-9.4 35.4-14 55.7-14C6458.5 2058.6 6476.9 2063.3 6493.7 2072.8zM6395.6 2092.7c-13.1 7.4-23.6 17.5-31.4 30.1-7.8 12.6-11.8 26.5-11.8 41.7.0 15.3 3.9 29.3 11.8 42 7.8 12.7 18.3 22.8 31.4 30.2 13.1 7.4 27.4 11.1 42.9 11.1s29.7-3.7 42.7-11.1 23.3-17.4 31.1-30.2c7.7-12.7 11.6-26.7 11.6-42s-3.9-29.2-11.6-41.8c-7.7-12.6-18.1-22.6-31.1-30s-27.2-11.2-42.6-11.2C6423 2081.5 6408.8 2085.2 6395.6 2092.7z"/><path fill="#6d6e71" d="M6826.5 2269.8l-126.3-169.1v169.1h-24.1v-210.6h25l126.3 169.3v-169.3h23.8v210.6H6826.5z"/><linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-4516.6152" y1="-2338.7222" x2="-4108.4111" y2="-1861.3982" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset="0" style="stop-color:#F69923"/><stop offset=".3123" style="stop-color:#F79A23"/><stop offset=".8383" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_1_)" d="M1230.1 13.7c-45.3 26.8-120.6 102.5-210.5 212.3l82.6 155.9c58-82.9 116.9-157.5 176.3-221.2 4.6-5.1 7-7.5 7-7.5-2.3 2.5-4.6 5-7 7.5-19.2 21.2-77.5 89.2-165.5 224.4 84.7-4.2 214.9-21.6 321.1-39.7 31.6-177-31-258-31-258S1323.4-41.4 1230.1 13.7z"/><path fill="none" d="M1090.2 903.1c.6-.1 1.2-.2 1.8-.3l-11.9 1.3c-.7.3-1.4.7-2.1 1C1082.1 904.4 1086.2 903.7 1090.2 903.1z"/><path fill="none" d="M1005.9 1182.3c-6.7 1.5-13.7 2.7-20.7 3.7C992.3 1185 999.2 1183.8 1005.9 1182.3z"/><path fill="none" d="M432.9 1808.8c.9-2.3 1.8-4.7 2.6-7 18.2-48 36.2-94.7 54-140.1 20-51 39.8-100.4 59.3-148.3 20.6-50.4 40.9-99.2 60.9-146.3 21-49.4 41.7-97 62-142.8 16.5-37.3 32.8-73.4 48.9-108.3 5.4-11.7 10.7-23.2 16-34.6 10.5-22.7 21-44.8 31.3-66.5 9.5-20 19-39.6 28.3-58.8 3.1-6.4 6.2-12.8 9.3-19.1.5-1 1-2 1.5-3.1l-10.2 1.1-8-15.9c-.8 1.6-1.6 3.1-2.4 4.6-14.5 28.8-28.9 57.9-43.1 87.2-8.2 16.9-16.4 34-24.6 51-22.6 47.4-44.8 95.2-66.6 143.3-22.1 48.6-43.7 97.5-64.9 146.5-20.8 48.1-41.3 96.2-61.2 144.2-20 48-39.5 95.7-58.5 143.2-19.9 49.5-39.2 98.7-58 147.2-4.2 10.9-8.5 21.9-12.7 32.8-15 39.2-29.7 77.8-44 116l12.7 25.1 11.4-1.2c.4-1.1.8-2.3 1.3-3.4C396.7 1905.4 414.9 1856.4 432.9 1808.8z"/><path fill="none" d="M980 1186.8c.1.0.1.0.1-.1C980.1 1186.8 980.1 1186.8 980 1186.8z"/><path fill="#be202e" d="M952.6 1323c-10.6 1.9-21.4 3.8-32.5 5.7-.1.0-.1.1-.2.1 5.6-.8 11.2-1.7 16.6-2.6C942 1325.2 947.3 1324.1 952.6 1323z"/><path opacity=".35" fill="#be202e" d="M952.6 1323c-10.6 1.9-21.4 3.8-32.5 5.7-.1.0-.1.1-.2.1 5.6-.8 11.2-1.7 16.6-2.6C942 1325.2 947.3 1324.1 952.6 1323z"/><path fill="#be202e" d="M980.3 1186.7C980.2 1186.7 980.2 1186.7 980.3 1186.7c-.1.1-.2.1-.2.1 1.8-.2 3.5-.5 5.2-.8 7-1 13.9-2.2 20.7-3.7C997.5 1183.8 989 1185.2 980.3 1186.7z"/><path opacity=".35" fill="#be202e" d="M980.3 1186.7C980.2 1186.7 980.2 1186.7 980.3 1186.7c-.1.1-.2.1-.2.1 1.8-.2 3.5-.5 5.2-.8 7-1 13.9-2.2 20.7-3.7C997.5 1183.8 989 1185.2 980.3 1186.7z"/><linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-7537.7339" y1="-2391.4075" x2="-4625.4141" y2="-2391.4075" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_2_)" d="M858.6 784.7c25.1-46.9 50.5-92.8 76.2-137.4 26.7-46.4 53.7-91.3 80.9-134.7 1.6-2.6 3.2-5.2 4.8-7.7 27-42.7 54.2-83.7 81.6-122.9L1019.5 226c-6.2 7.6-12.5 15.3-18.8 23.2-23.8 29.7-48.6 61.6-73.9 95.5-28.6 38.2-58 78.9-87.8 121.7-27.6 39.5-55.5 80.9-83.5 123.7-23.8 36.5-47.7 74-71.4 112.5-.9 1.4-1.8 2.9-2.6 4.3L789 919.2c22.8-45.6 46.1-90.5 69.6-134.5z"/><linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="-7186.1777" y1="-2099.3059" x2="-5450.7183" y2="-2099.3059" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset="0" style="stop-color:#282662"/><stop offset=".0954839" style="stop-color:#662E8D"/><stop offset=".7882" style="stop-color:#9F2064"/><stop offset=".9487" style="stop-color:#CD2032"/></linearGradient><path fill="url(#SVGID_3_)" d="M369 1981c-14.2 39.1-28.5 78.9-42.9 119.6-.2.6-.4 1.2-.6 1.8-2 5.7-4.1 11.5-6.1 17.2-9.7 27.4-18 52.1-37.3 108.2 31.7 14.5 57.1 52.5 81.1 95.6-2.6-44.7-21-86.6-56.2-119.1 156.1 7 290.6-32.4 360.1-146.6 6.2-10.2 11.9-20.9 17-32.2-31.6 40.1-70.8 57.1-144.5 53-.2.1-.3.1-.5.2.2-.1.3-.1.5-.2 108.6-48.6 163.1-95.3 211.2-172.6 11.4-18.3 22.5-38.4 33.8-60.6-94.9 97.5-205 125.3-320.9 104.2l-86.9 9.5C374.4 1966.3 371.7 1973.6 369 1981z"/><linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-7374.1626" y1="-2418.5454" x2="-4461.8428" y2="-2418.5454" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_4_)" d="M409.6 1786.3c18.8-48.5 38.1-97.7 58-147.2 19-47.4 38.5-95.2 58.5-143.2s40.4-96.1 61.2-144.2c21.2-49 42.9-97.8 64.9-146.5 21.8-48.1 44-95.9 66.6-143.3 8.1-17.1 16.3-34.1 24.6-51 14.2-29.3 28.6-58.4 43.1-87.2.8-1.6 1.6-3.1 2.4-4.6L681.4 706.8c-1.8 2.9-3.5 5.8-5.3 8.6-25.1 40.9-50 82.7-74.4 125.4-24.7 43.1-49 87.1-72.7 131.7-20 37.6-39.6 75.6-58.6 113.9-3.8 7.8-7.6 15.5-11.3 23.2-23.4 48.2-44.6 94.8-63.7 139.5-21.7 50.7-40.7 99.2-57.5 145.1-11 30.2-21 59.4-30.1 87.4-7.5 24-14.7 47.9-21.5 71.8-16 56.3-29.9 112.4-41.2 168.3L353 1935.1c14.3-38.1 28.9-76.8 44-116C401.1 1808.2 405.4 1797.3 409.6 1786.3z"/><linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="-7161.7642" y1="-2379.1431" x2="-5631.2524" y2="-2379.1431" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset="0" style="stop-color:#282662"/><stop offset=".0954839" style="stop-color:#662E8D"/><stop offset=".7882" style="stop-color:#9F2064"/><stop offset=".9487" style="stop-color:#CD2032"/></linearGradient><path fill="url(#SVGID_5_)" d="M243.5 1729.4c-13.6 68.2-23.2 136.2-28 203.8-.2 2.4-.4 4.7-.5 7.1-33.7-54-124-106.8-123.8-106.2 64.6 93.7 113.7 186.7 120.9 278-34.6 7.1-82-3.2-136.8-23.3 57.1 52.5 1e2 67 116.7 70.9-52.5 3.3-107.1 39.3-162.1 80.8 80.5-32.8 145.5-45.8 192.1-35.3C148.1 2414.2 74.1 2645 0 2890c22.7-6.7 36.2-21.9 43.9-42.6 13.2-44.4 100.8-335.6 238-718.2 3.9-10.9 7.8-21.8 11.8-32.9 1.1-3 2.2-6.1 3.3-9.2 14.5-40.1 29.5-81.1 45.1-122.9 3.5-9.5 7.1-19 10.7-28.6.1-.2.1-.4.2-.6l-107.9-213.2C244.6 1724.4 244 1726.9 243.5 1729.4z"/><linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="-7374.1626" y1="-2117.1309" x2="-4461.8428" y2="-2117.1309" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_6_)" d="M805.6 937c-3.1 6.3-6.2 12.7-9.3 19.1-9.3 19.2-18.8 38.8-28.3 58.8-10.3 21.7-20.7 43.9-31.3 66.5-5.3 11.4-10.6 22.9-16 34.6-16.1 35-32.4 71.1-48.9 108.3-20.3 45.8-41 93.4-62 142.8-20 47.1-40.3 95.9-60.9 146.3-19.5 47.9-39.3 97.3-59.3 148.3-17.8 45.4-35.9 92.1-54 140.1-.9 2.3-1.8 4.7-2.6 7-18 47.6-36.2 96.6-54.6 146.8-.4 1.1-.8 2.3-1.3 3.4l86.9-9.5c-1.7-.3-3.5-.5-5.2-.9 103.9-13 242.1-90.6 331.4-186.5 41.1-44.2 78.5-96.3 113-157.3 25.7-45.4 49.8-95.8 72.8-151.5 20.1-48.7 39.4-101.4 58-158.6-23.9 12.6-51.2 21.8-81.4 28.2-5.3 1.1-10.7 2.2-16.1 3.1-5.5 1-11 1.8-16.6 2.6.1.0.1-.1.2-.1 96.9-37.3 158-109.2 202.4-197.4-25.5 17.4-66.9 40.1-116.6 51.1-6.7 1.5-13.7 2.7-20.7 3.7-1.7.3-3.5.6-5.2.8.1.0.1.0.1-.1h.1c33.6-14.1 62-29.8 86.6-48.4 5.3-4 10.4-8.1 15.3-12.3 7.5-6.5 14.7-13.3 21.5-20.5 4.4-4.6 8.6-9.3 12.7-14.2 9.6-11.5 18.7-23.9 27.1-37.3 2.6-4.1 5.1-8.3 7.6-12.6 3.2-6.2 6.3-12.3 9.3-18.3 13.5-27.2 24.4-51.5 33-72.8 4.3-10.6 8.1-20.5 11.3-29.7 1.3-3.7 2.5-7.2 3.7-10.6 3.4-10.2 6.2-19.3 8.4-27.3 3.3-12 5.3-21.5 6.4-28.4-3.3 2.6-7.1 5.2-11.3 7.7-29.3 17.5-79.5 33.4-119.9 40.8l79.8-8.8-79.8 8.8c-.6.1-1.2.2-1.8.3-4 .7-8.1 1.3-12.2 2 .7-.3 1.4-.7 2.1-1l-273 29.9C806.6 935 806.1 936 805.6 937z"/><linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="-7554.8232" y1="-2132.0981" x2="-4642.5034" y2="-2132.0981" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_7_)" d="M1112.9 385.1c-24.3 37.3-50.8 79.6-79.4 127.5-1.5 2.5-3 5.1-4.5 7.6-24.6 41.5-50.8 87.1-78.3 137-23.8 43.1-48.5 89.3-74.3 139C854 839.5 830.8 885.4 807 934l273-29.9c79.5-36.6 115.1-69.7 149.6-117.6 9.2-13.2 18.4-27 27.5-41.3 28-43.8 55.6-92 80.1-139.9 23.7-46.3 44.7-92.2 60.7-133.5 10.2-26.3 18.4-50.8 24.1-72.3 5-19 8.9-36.9 11.9-54.1C1327.9 363.5 1197.6 380.9 1112.9 385.1z"/><path fill="#be202e" d="M936.5 1326.1c-5.5 1-11 1.8-16.6 2.6C925.5 1328 931 1327.1 936.5 1326.1z"/><path opacity=".35" fill="#be202e" d="M936.5 1326.1c-5.5 1-11 1.8-16.6 2.6C925.5 1328 931 1327.1 936.5 1326.1z"/><linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="-7374.1626" y1="-2027.484" x2="-4461.8433" y2="-2027.484" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_8_)" d="M936.5 1326.1c-5.5 1-11 1.8-16.6 2.6C925.5 1328 931 1327.1 936.5 1326.1z"/><path fill="#be202e" d="M980 1186.8c1.8-.2 3.5-.5 5.2-.8C983.5 1186.3 981.8 1186.6 980 1186.8z"/><path opacity=".35" fill="#be202e" d="M980 1186.8c1.8-.2 3.5-.5 5.2-.8C983.5 1186.3 981.8 1186.6 980 1186.8z"/><linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-7374.1626" y1="-2037.7417" x2="-4461.8433" y2="-2037.7417" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_9_)" d="M980 1186.8c1.8-.2 3.5-.5 5.2-.8C983.5 1186.3 981.8 1186.6 980 1186.8z"/><path fill="#be202e" d="M980.2 1186.7z"/><path opacity=".35" fill="#be202e" d="M980.2 1186.7z"/><linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-5738.0635" y1="-2039.799" x2="-5094.3457" y2="-2039.799" gradientTransform="matrix(0.4226 -0.9063 0.9063 0.4226 5117.8774 -2859.9343)"><stop offset=".3233" style="stop-color:#9E2064"/><stop offset=".6302" style="stop-color:#C92037"/><stop offset=".7514" style="stop-color:#CD2335"/><stop offset="1" style="stop-color:#E97826"/></linearGradient><path fill="url(#SVGID_10_)" d="M980.2 1186.7z"/></svg></div></a><ul class=footer-link><li><a class=white href=http://www.apache.org>Foundation</a></li><li><a class=white href=http://www.apache.org/licenses/>License</a></li><li><a class=white href=https://www.apache.org/security/>Security</a></li><li><a class=white href=http://www.apache.org/events/current-event>Events</a></li><li><a class=white href=http://www.apache.org/foundation/sponsorship.html>Sponsorship</a></li><li><a class=white href=http://www.apache.org/foundation/thanks.html>Thanks</a></li><li><a class=white href=https://privacy.apache.org/policies/privacy-policy-public.html target=_blank>Privacy</a></li></ul></div></div><div class="col-6 text-white text-center container-center"><p>Copyright &copy; 2024 The Apache Software Foundation, Licensed under the <a class=white href=https://www.apache.org/licenses/LICENSE-2.0>Apache License Version 2.0</a></p><p>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p></div><div class=col-1></div></div></div></footer></div><script src=https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js integrity=sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN crossorigin=anonymous></script>
<script src=https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js integrity="sha512-UR25UO94eTnCVwjbXozyeVd6ZqpaAE9naiEUBK/A+QDbfSTQFhPGj5lOR6d8tsgbBk84Ggb5A3EkjsOgPRPcKA==" crossorigin=anonymous></script>
<script src=/js/tabpane-persist.js></script>
<script src=/js/main.min.aa9f4c5dae6a98b2c46277f4c56f1673a2b000d1756ce4ffae93784cab25e6d5.js integrity="sha256-qp9MXa5qmLLEYnf0xW8Wc6KwANF1bOT/rpN4TKsl5tU=" crossorigin=anonymous></script>
<script src=/js/prism.js></script></body></html>