imbajin commented on code in PR #499:
URL: https://github.com/apache/hugegraph-doc/pull/499#discussion_r4111235762


##########
content/en/docs/language/hugegraph-cypher.md:
##########
@@ -0,0 +1,150 @@
+---
+title: "HugeGraph Cypher"
+linkTitle: "Cypher Query Language"
+weight: 2
+---
+
+### Overview
+
+HugeGraph supports [Cypher](https://opencypher.org/), the declarative graph 
query language originally created by Neo4j and standardized as 
[openCypher](https://github.com/opencypher/openCypher). While Gremlin is an 
imperative traversal language, Cypher lets you describe the graph pattern you 
want (`MATCH`, `WHERE`, `RETURN`) and lets the engine decide how to execute it.
+
+HugeGraph executes Cypher by translating the statement to Gremlin through the 
[cypher-for-gremlin](https://github.com/opencypher/cypher-for-gremlin) 
transpiler, then running the resulting traversal on the TinkerPop stack. This 
means Cypher support in HugeGraph covers the openCypher 9 surface that the 
transpiler implements — see [Known limitations](#known-limitations) below.
+
+### When to use Cypher vs Gremlin
+
+| Use Cypher when | Use Gremlin when |
+|---|---|
+| You are migrating from Neo4j or already know Cypher | You need the full 
HugeGraph feature surface |
+| You want declarative pattern matching (`MATCH (a)-[:KNOWS]->(b)`) | You need 
fine-grained traversal control, custom steps, or lambdas |
+| Your queries are read-mostly patterns and projections | You need graph 
algorithms, OLAP, or features Cypher does not expose |
+
+For anything Cypher cannot express, the equivalent Gremlin query always works 
— examples below show both.
+
+### Calling the Cypher API
+
+Cypher statements are submitted to the HugeGraph Server through the REST 
endpoint:
+
+```http
+GET  /graphspaces/{graphspace}/graphs/{graph}/cypher?cypher={statement}
+POST /graphspaces/{graphspace}/graphs/{graph}/cypher
+```
+
+The endpoint always requires an `Authorization` header (`Basic` or `Bearer`), 
even when server authentication is disabled — the credentials are forwarded to 
the Gremlin Server. See the [Cypher REST API 
reference](/docs/clients/restful-api/cypher/) for the full request/response 
format.

Review Comment:
   ⚠️ Important: This says Basic credentials are supported without 
qualification, but CypherAPI uses Base64.getUrlDecoder() and splits the decoded 
credential on every colon. Standard Basic values can contain + or / in Base64, 
and a valid password can contain :, so these credentials are rejected. Please 
fix the parser or document the accepted credential format.



##########
content/en/docs/language/migrate-from-neo4j.md:
##########
@@ -0,0 +1,62 @@
+---
+title: "Migrating from Neo4j"
+linkTitle: "Migrating from Neo4j"
+weight: 4
+---
+
+### Who this page is for
+
+Neo4j users evaluating HugeGraph. HugeGraph's Cypher coverage is defined by
+the [`cypher-for-gremlin`](https://github.com/opencypher/cypher-for-gremlin)
+translator and is not 1:1 with Neo4j — see the
+[Cypher compatibility notes](/docs/language/cypher-compatibility/) for the
+verified and unverified areas and
+[HugeGraph Cypher](/docs/language/hugegraph-cypher/) for usage.
+
+### What carries over directly
+
+| Neo4j concept | HugeGraph equivalent |
+|---|---|
+| Property graph model (nodes / relationships / properties) | Same — vertex 
labels / edge labels / properties |
+| Core Cypher: `MATCH`/`WHERE`/`RETURN`/`CREATE`/`SET`/`DELETE` | Works as-is 
(REST `/cypher` endpoint or Java client `CypherManager`) |
+| Simple aggregations (`count`/`sum`/`min`/`max`/`avg`) | Works as-is |
+| Traversal-heavy queries | Gremlin traversals or the [traverser REST 
APIs](/docs/clients/restful-api/traverser/) (k-out, shortest path, 
personalrank, ...) |
+
+### Habits you need to change
+
+| In Neo4j | In HugeGraph |
+|---|---|
+| `CREATE INDEX` / `CREATE CONSTRAINT` | Create indexes/constraints through 
the [schema REST APIs](/docs/clients/restful-api/schema/); Cypher carries no 
DDL |
+| Implicit schema (add properties freely) | **Strong schema**: define 
VertexLabel / EdgeLabel / PropertyKey before writing data |
+| Parameterized queries `$param` | Released versions send the raw statement 
only — a missing binding evaluates to `null` (empty result), so validate values 
client-side; JSON-bound parameters land in [PR 
#238](https://github.com/hugegraph/hugegraph/pull/238) |
+| `CALL dbms.*` / `CALL algo.*` procedures | Equivalent capabilities live in 
the [traverser](/docs/clients/restful-api/traverser/), 
[task](/docs/clients/restful-api/task/), and other REST APIs |
+| Driver: Neo4j Bolt driver | 
[hugegraph-client](/docs/clients/hugegraph-client/) (`CypherManager`) or any 
HTTP client |
+| Transaction boundaries inside a Cypher statement | One statement per 
request; bulk imports use the [HugeGraph 
Loader](/docs/quickstart/toolchain/hugegraph-loader/) |
+
+### Suggested migration path
+
+1. **Inventory your queries**: classify the Cypher in your application against
+   the [compatibility notes](/docs/language/cypher-compatibility/) into
+   "works as-is / rewrite as Gremlin / switch to a REST API".
+2. **Create the schema first**: define VertexLabel / EdgeLabel / PropertyKey
+   and indexes through the schema API — HugeGraph requires the schema to
+   exist before data is written.
+3. **Import data**: REST for small datasets; the
+   [HugeGraph 
Loader](https://github.com/apache/hugegraph-toolchain/tree/master/hugegraph-loader)
+   for bulk loads.
+4. **Switch incrementally**: keep the queries Cypher can express, and rewrite
+   translator-unsupported constructs as Gremlin — the
+   [equivalents table](/docs/language/hugegraph-cypher/#gremlin-equivalents)
+   shows the mapping.
+
+### Known limitations at a glance
+
+- Released versions support neither parameter binding (a missing binding
+  evaluates to `null` — see the habits table), multi-statement
+  scripts, nor `CALL` procedures.
+- The translator's last release is 2019-11 (1.0.4); its own TCK self-report is
+  879 pass / 79 fail (~91.7%) — uncovered syntax fails at translation time.

Review Comment:
   🧹 Minor: 879 / (879 + 79) = 91.7536%, which rounds to 91.8% at one decimal. 
Please change 91.7% to 91.8% here and in the Chinese copy.



##########
content/en/docs/language/migrate-from-neo4j.md:
##########
@@ -0,0 +1,62 @@
+---
+title: "Migrating from Neo4j"
+linkTitle: "Migrating from Neo4j"
+weight: 4
+---
+
+### Who this page is for
+
+Neo4j users evaluating HugeGraph. HugeGraph's Cypher coverage is defined by
+the [`cypher-for-gremlin`](https://github.com/opencypher/cypher-for-gremlin)
+translator and is not 1:1 with Neo4j — see the
+[Cypher compatibility notes](/docs/language/cypher-compatibility/) for the
+verified and unverified areas and
+[HugeGraph Cypher](/docs/language/hugegraph-cypher/) for usage.
+
+### What carries over directly
+
+| Neo4j concept | HugeGraph equivalent |
+|---|---|
+| Property graph model (nodes / relationships / properties) | Same — vertex 
labels / edge labels / properties |
+| Core Cypher: `MATCH`/`WHERE`/`RETURN`/`CREATE`/`SET`/`DELETE` | Works as-is 
(REST `/cypher` endpoint or Java client `CypherManager`) |
+| Simple aggregations (`count`/`sum`/`min`/`max`/`avg`) | Works as-is |
+| Traversal-heavy queries | Gremlin traversals or the [traverser REST 
APIs](/docs/clients/restful-api/traverser/) (k-out, shortest path, 
personalrank, ...) |
+
+### Habits you need to change
+
+| In Neo4j | In HugeGraph |
+|---|---|
+| `CREATE INDEX` / `CREATE CONSTRAINT` | Create indexes/constraints through 
the [schema REST APIs](/docs/clients/restful-api/schema/); Cypher carries no 
DDL |

Review Comment:
   ⚠️ Important: This links index and constraint creation to the Schema API 
overview, which documents GET /schema; index creation is documented under 
IndexLabel at POST /schema/indexlabels. Please link to the IndexLabel API and 
clarify which constraint types map to HugeGraph unique indexes.



##########
content/cn/docs/language/cypher-compatibility.md:
##########
@@ -0,0 +1,76 @@
+---
+title: "Cypher 兼容性"
+linkTitle: "Cypher 兼容性"
+weight: 3
+---
+
+### 范围
+
+本页记录当前 Cypher 开发改动实际验证过的用例,不代表完整支持 openCypher 或 Neo4j,也不代表所有已发布
+版本的 HugeGraph 都具备相同行为。测试代码基于
+[`hugegraph/hugegraph@27a7c9b`](https://github.com/hugegraph/hugegraph/commit/27a7c9b42274d6d4f95eabed6d2051d393ae0eaf),
+使用 Java `17.0.20.1`、TinkerPop 
`3.8.1`、`org.opencypher.gremlin:translation:1.0.4` 和 RocksDB。
+
+接口路径为 `/graphspaces/{graphspace}/graphs/{graph}/cypher`。一般用法见
+[HugeGraph Cypher 指南](/cn/docs/language/hugegraph-cypher/)。
+
+### 请求形式与参数
+
+| 请求 | 已验证行为 | 测试方法 |
+|---|---|---|
+| `GET ?cypher=<URL 编码的语句>` | 保留原有查询参数形式 | `testGet` |
+| `POST application/json`,请求体为原始 Cypher 文本 | 保留旧的原始文本请求形式 | `testPost` |
+| `POST text/plain`,请求体为原始 Cypher 文本 | 支持纯文本请求 | `testPlainTextPost` |
+| `POST application/json`,请求体为 JSON 对象 | 查询语句与参数分开传入 | `testParameters` |
+
+```json
+{
+  "cypher": "MATCH (n:cypher_person) WHERE n.name = $name RETURN n.name",
+  "parameters": {"name": "marko"}
+}
+```
+
+JSON 对象中的 `cypher` 必须是非空字符串;`parameters` 若提供,必须是对象。省略 `parameters` 表示空参数表。

Review Comment:
   🧹 Minor: 非空字符串 also includes whitespace-only values, while the English 
contract is nonblank and the API rejects cypher.isBlank(). Please change this 
to 非空白字符串 to match the API.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to