StickyMeta
Defined in: 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-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: src/sticky_meta.ts:59
Creates a new schema, which is an instance of sticky meta configuration
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | specifies name of new schema |
types | object[] | list of types that schema is applied to. Every type has a name and a matching expression it applies to. |
properties | object[] | list of typed properties that can be stored within the schema |
Returns
Promise<Schema>
.
deleteSchema()
deleteSchema(
id):Promise<void>
Defined in: src/sticky_meta.ts:88
Deletes schema by ID
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | identifier of a schema |
Returns
Promise<void>
getAllValues()
getAllValues(
schema,keys):Promise<DataFrame>
Defined in: src/sticky_meta.ts:47
Fetches sticky meta values for list of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | configuration of sticky meta to fetch data for. |
keys | Column | column 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: src/sticky_meta.ts:24
Fetch available sticky meta configurations
Returns
Promise<Schema[]>
list of schemas
saveSchema()
saveSchema(
schema):Promise<void>
Defined in: src/sticky_meta.ts:80
Saves modified schema.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | modified schema |
Returns
Promise<void>
setAllValues()
setAllValues(
schema,keys,values):Promise<void>
Defined in: src/sticky_meta.ts:36
Saves sticky meta values for list of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | a configuration of sticky meta to be applied |
keys | Column | a column with identifiers of entities. This column should be configured with tags so type of entity would be recognizable. |
values | DataFrame | a dataframe with metadata values to set. Names of columns in this dataframe should match property names of schema. |
Returns
Promise<void>