Check if class exists or not in orientdb

放肆的年华 提交于 2019-12-05 08:38:33

You can retrieve schema information via SQL with the following statement:

 select expand(classes) from metadata:schema 

In particular, to retrieve a single class:

 select from (
    select expand(classes) from metadata:schema
 ) where name = 'YourClassName'

From Java:

 ODatabaseDocumentTx db = ...
 if(db.getMetadata().getSchema().existsClass("ClassName")){
   ...
 }

If you have an OrientGraph, you can get the underlying ODatabaseDocumentTx with

 graph.getRawGraph();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!