Skip to main content

StickyMeta

Defined in: js-api/src/sticky_meta.ts:18

API for Sticky meta. Allows attaching arbitrary metadata on custom entities. Can be applied to a column of entities based on semtype or column tags.

See samples: https://public.datagrok.ai/js/samples/dapi/sticky-meta-1-tags

Example​

var schema = await dapi.stickyMeta.createSchema('test-schema', {name: 'molecule', matchBy: 'semtype=molecule'}, {name: 'prop', type: 'string'});
var metadata = await dapi.stickyMeta.getAllValues(schema, DG.Column.fromList('string', 'key', ['h2o']));

Constructors​

Constructor​

new StickyMeta(): StickyMeta

Returns​

StickyMeta

Methods​

createSchema()​

createSchema(name, types, properties): Promise<Schema>

Defined in: js-api/src/sticky_meta.ts:54

Creates a new schema, which is an instance of sticky meta configuration

Parameters​

ParameterTypeDescription
namestringspecifies name of new schema
typesobject[]list of types that schema is applied to. Every type has a name and a matching expression it applies to.
propertiesobject[]list of typed properties that can be stored within the schema

Returns​

Promise<Schema>


deleteSchema()​

deleteSchema(id): Promise<void>

Defined in: js-api/src/sticky_meta.ts:81

Deletes schema by ID

Parameters​

ParameterTypeDescription
idstringidentifier of a schema

Returns​

Promise<void>


getAllValues()​

getAllValues(schema, keys): Promise<DataFrame>

Defined in: js-api/src/sticky_meta.ts:44

Fetches sticky meta values for list of entities.

Parameters​

ParameterTypeDescription
schemaSchemaconfiguration of sticky meta to fetch data for.
keysColumncolumn with identifiers of entities. This column should be configured with tags so type of entity would be recognizable.

Returns​

Promise<DataFrame>

, where properties for keys are stored in columns with respective name


getSchemas()​

getSchemas(): Promise<Schema[]>

Defined in: js-api/src/sticky_meta.ts:23

Fetch available sticky meta configurations

Returns​

Promise<Schema[]>

list of schemas


saveSchema()​

saveSchema(schema): Promise<void>

Defined in: js-api/src/sticky_meta.ts:74

Saves modified schema.

Parameters​

ParameterTypeDescription
schemaSchemamodified schema

Returns​

Promise<void>


setAllValues()​

setAllValues(schema, keys, values): Promise<void>

Defined in: js-api/src/sticky_meta.ts:34

Saves sticky meta values for list of entities.

Parameters​

ParameterTypeDescription
schemaSchemaa configuration of sticky meta to be applied
keysColumna column with identifiers of entities. This column should be configured with tags so type of entity would be recognizable.
valuesDataFramea dataframe with metadata values to set. Names of columns in this dataframe should match property names of schema.

Returns​

Promise<void>