StickyMeta
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
new StickyMeta()
new StickyMeta():
StickyMeta
Returns
Methods
createSchema()
createSchema(
name,types,properties):Promise<Schema>
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>
.
Source
deleteSchema()
deleteSchema(
id):Promise<void>
Deletes schema by ID
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | identifier of a schema |
Returns
Promise<void>
Source
getAllValues()
getAllValues(
schema,keys):Promise<DataFrame>
Fetches sticky meta values for list of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | configuration of sticky meta to fetch data for. |
keys | Column<any, any> | 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
Source
getSchemas()
getSchemas():
Promise<Schema[]>
Fetch available sticky meta configurations
Returns
Promise <Schema[]>
list of schemas
Source
saveSchema()
saveSchema(
schema):Promise<void>
Saves modified schema.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | modified schema |
Returns
Promise<void>
Source
setAllValues()
setAllValues(
schema,keys,values):Promise<void>
Saves sticky meta values for list of entities.
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | Schema | a configuration of sticky meta to be applied |
keys | Column<any, any> | 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>