How to create custom classes in orientdb using Gre

2019-06-28 05:56发布

问题:

I want the equivalant of this syntax in SQL:

create class Person extends V

in Gremlin

回答1:

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.

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");

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