Ironluca
Ironluca

Reputation: 3762

OrientDB add/edit description attribute of classes with SQL

I am using OrientDB 3.1.1. All the classes have a 'description' attribute whose value is by default null. Is there any way to add description to the class through SQL or by other means.

I have tried ALTER CLASS <className> DESCRIPTION "some text as description". Does not work at all.

It should be a simple matter to update the description but apparently it does not seem to be that way for some reason.

Below is an example of a built in class but it holds good for all classes.

{
customFields: null
defaultClusterId: 10
strictMode: false
description: null
abstract: false
clusterIds: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
superClass: null
name: V
clusterSelection: round-robin
shortName: null
overSize: 0.0
properties: []
superClasses: null
}

Upvotes: 0

Views: 66

Answers (1)

Ironluca
Ironluca

Reputation: 3762

After some experimentation; I found that the following syntax works to add or alter a description for a class (though it is not explicitly documented in manual).

ALTER CLASS xClass DESCRIPTION `xClass desc1` 

Note the tick (``) marks, not single quotes; double quotes will also not work

{
    "customFields": null,
    "defaultClusterId": 22,
    "strictMode": false,
    "description": "xClass desc1",
    "abstract": false,
    "clusterIds": [22, 23, 24, 25],
    "superClass": null,
    "name": "xClass",
    "clusterSelection": "round-robin",
    "shortName": null,
    "overSize": 0.0,
    "properties": [],
    "superClasses": null
}

With the above command the description can be set or altered, as observed in the above example.

NOTE: In case of attribute the syntax is similar, single quote needs to be used instead of tick marks.

Upvotes: 1

Related Questions