dosubot[bot] commented on issue #2679:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2679#issuecomment-2416160263

   <!-- Answer -->
   To create HugeGraph graph schema metadata such as `VertexLabel` and 
`EdgeLabel` using Gremlin syntax, you can use the following examples:
   
   **Creating VertexLabel:**
   
   ```groovy
   person = graph.schema().vertexLabel("person").properties("name", "age", 
"city").primaryKeys("name").ifNotExist().create()
   software = graph.schema().vertexLabel("software").properties("name", "lang", 
"price").primaryKeys("name").ifNotExist().create()
   ```
   
   **Creating EdgeLabel:**
   
   ```groovy
   knows = 
graph.schema().edgeLabel("knows").sourceLabel("person").targetLabel("person").properties("date").ifNotExist().create()
   created = 
graph.schema().edgeLabel("created").sourceLabel("person").targetLabel("software").properties("date",
 "city").ifNotExist().create()
   ```
   
   These examples demonstrate how to define vertex and edge labels with 
associated properties and primary keys using Gremlin syntax in HugeGraph. 
Additionally, you can create property keys before defining vertex and edge 
labels:
   
   **Creating PropertyKey:**
   
   ```groovy
   graph.schema().propertyKey("name").asText().ifNotExist().create()
   graph.schema().propertyKey("age").asInt().ifNotExist().create()
   graph.schema().propertyKey("city").asText().ifNotExist().create()
   graph.schema().propertyKey("lang").asText().ifNotExist().create()
   graph.schema().propertyKey("date").asText().ifNotExist().create()
   graph.schema().propertyKey("price").asInt().ifNotExist().create()
   ```
   
   These property keys are then used in the vertex and edge label definitions 
<sup>[[1]](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/en/docs/quickstart/hugegraph-studio.md)</sup><sup>[[2]](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/cn/docs/quickstart/hugegraph-studio.md)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


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