如何使用Gremlin在OrientDB中创建自定义类 [英] How to create custom classes in orientdb using Gremlin

查看:188
本文介绍了如何使用Gremlin在OrientDB中创建自定义类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在SQL中使用这种语法:

I want the equivalant of this syntax in SQL:

create class Person extends V

格雷姆林宫

推荐答案

我不确定是否可以通过Gremlin操作OrientDB模式. Gremlin独立于OrientDB,并且不适用于架构,因为并非所有图形数据库都支持架构.

I'm not sure it is possible to manipulate OrientDB schema through Gremlin. Gremlin is independent on OrientDB and is not adapted on schemas because not all of graph databases support schemas.

要在OrientDB中添加特定类的顶点,可以使用Graph API(请参见 doc ).如果在类名之前添加字符串class:,则将创建该类的顶点.

For adding vertex of particular class in OrientDB you can use Graph API (see doc). If you prepend string class: before the name of the class, you will create a vertex of this class.

graph.addVertex("class:User");

此代码段将创建类User的顶点.希望对您有帮助.

This snippet will create vertex of class User. I hope it will help you.

这篇关于如何使用Gremlin在OrientDB中创建自定义类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆