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


##########
content/en/docs/language/migrate-from-neo4j.md:
##########
@@ -0,0 +1,111 @@
+---
+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
+[Known limitations](/docs/language/hugegraph-cypher/#known-limitations) for 
what
+released HugeGraph versions do, and the
+[Cypher compatibility notes](/docs/language/cypher-compatibility/) for the
+development-tree verification record 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`), subject to the schema 
and index rules below |
+| 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 property indexes through the 
[IndexLabel REST API](/docs/clients/restful-api/indexlabel/); uniqueness 
constraints map to `UNIQUE` IndexLabels (which reject duplicates with a 
conflict error). Node keys map to non-nullable keys plus a composite `UNIQUE` 
index. Property existence constraints map to non-nullable keys on 
[VertexLabels](/docs/clients/restful-api/vertexlabel/) or 
[EdgeLabels](/docs/clients/restful-api/edgelabel/). Note that `primary_keys` 
defines vertex identity rather than a constraint—a duplicate `CREATE` 
overwrites instead of failing |

Review Comment:
   Minor: this refines the node key and uniqueness mapping I suggested in the 
earlier thread on this line. It does not work when the constrained key is also 
the label's primary key, which is the setup step 3 (line 77) recommends for 
`idStrategy = "PRIMARY_KEY"`.
   
   `IndexLabelBuilder.checkPrimaryKeyIndex` rejects a `UNIQUE` index on a 
`PRIMARY_KEY` vertex label when its fields contain all of the label's primary 
keys ("No need to build index on properties ..., because they contains all 
primary keys ..."). The check is the same in 1.0.0, 1.7.0 and master (line 627 
on 1.7.0 and master). A reader who puts the Neo4j business key in `idFields` 
cannot create the `UNIQUE` IndexLabel this row names, and keeps only the 
overwrite on a duplicate.
   
   Requested change: say that a `UNIQUE` index cannot include all primary keys 
of a `PRIMARY_KEY` label. To keep duplicate rejection, use `CUSTOMIZE_STRING` 
keyed on the Neo4j node id (as in step 3) with a `UNIQUE` index on the business 
key. Mirror this in the CN row (line 29).



-- 
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