Dropping graph schema

Dropping (deleting) graph schema.

Schema can be dropped (deleted) using the drop() step; see propertyKey, vertexLabel, and edgeLabel for more information.

Procedure

Drop schema

  • To drop the schema and all data without dropping the graph, use a drop() step. Running describe() after will verify that the schema is dropped. After the schema is dropped, new schema and data can be loaded to the graph.
    schema.drop()
    =>null
  • To drop schema for a particular property key, specify the property key and then use the drop() step:
    schema.propertyKey('aBadProperty').drop()
    Warning: To drop a property key for a vertex label that has a materialized view index, additional steps are required to prevent data loss or cluster errors. Drop any materialized indexes for the vertex label, drop the property key, and then rebuild the schema for the materialized view indexes. The MV index data will be recreated from the base table, with the exception of the data for the dropped property key.
  • To drop schema for a particular vertex label, specify the vertex label and then use the drop() step:
    schema.vertexLabel('aBadVertexLabel').drop()

Drop index

  • To drop an index from the schema, such as the byMeal index, identify the index by name. Use describe() to examine all indexes for the desired vertex label first.
    gremlin> schema.vertexLabel('meal').describe()
    ==>schema.vertexLabel('meal').properties("name").create()
    schema.vertexLabel('meal').index('byMeal').materialized().by('name').add()
  • Using the vertex label and index name, remove the index. Running describe() again will verify that the index is removed.
    gremlin> schema.vertexLabel('meal').index('byMeal').drop()
    ==>null
  • Remove only one property from a search index:
    schema.vertexLabel('author').index('search').search().properties('nick_name').drop()
    schema.vertexLabel('author').describe()