Namespace LABKEY.Domain
Domain static class to retrieve and edit domain definitions.
A domain is a collection of fields. Each data type (e.g., Assays, Lists, Datasets, Sample Sets and Custom Protein Lists) provides specialized handling for the domains it defines. The number of domains defined by a data type varies; for example, Assays define multiple domains (batch, run, etc.), while Lists and Datasets define only one domain each.
Additional Documentation:
Defined in: Domain.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
LABKEY.Domain.create(config)
Create a new domain with the given kind, domainDesign, and options or
specify a domain template to use for the domain creation.
|
<static> |
LABKEY.Domain.drop(config, config)
Delete a domain.
|
<static> |
LABKEY.Domain.get(config)
This api is deprecated, use LABKEY.Domain.getDomainDetails instead.
|
<static> |
LABKEY.Domain.getDomainDetails(config)
Gets a domain design along with domain kind specific properties.
|
<static> |
LABKEY.Domain.getProperties(config)
Get property descriptor information.
|
<static> |
LABKEY.Domain.listDomains(config)
Lists all the domains within a given container.
|
<static> |
LABKEY.Domain.save(config)
Saves the provided domain design.
|
Method Detail
<static>
LABKEY.Domain.create(config)
Create a new domain with the given kind, domainDesign, and options or
specify a domain template to use for the domain creation.
Not all domain kinds can be created through this API. Currently supported domain kinds are:
"IntList", "VarList", "SampleSet", "DataClass", "StudyDatasetDate", "StudyDatasetVisit", "Vocabulary".
Create domain:LABKEY.Domain.create({ kind: "IntList", domainDesign: { name: "LookupCodes", description: "integer key list", fields: [{ name: "id", rangeURI: "int" },{ name: "code", rangeURI: "string", scale: 4 }] }, options: { keyName: "id" } });
Create domain from a domain template:LABKEY.Domain.create({ module: "mymodule", domainGroup: "codes", domainTemplate: "LookupCodes", importData: false });
Import the initial data from the domain template of a previously created domain:LABKEY.Domain.create({ module: "mymodule", domainGroup: "codes", domainTemplate: "LookupCodes", createDomain: false, importData: true });
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required success callback.
- {Function} config.failure Optional
- Failure callback.
- {String} config.kind
- The domain kind to create. One of "IntList", "VarList", "SampleSet", or "DataClass".
- {String} config.domainName
- The name of the domain to create.
- {String} config.module
- The name of a module that contains the domain template group.
- {String} config.domainGroup
- The name of a domain template group.
- {String} config.domainTemplate
- The name of a domain template within the domain group.
- {Boolean} config.createDomain
- When using a domain template, create the domain. Defaults to true.
- {Boolean} config.importData
- When using a domain template, import initial data associated in the template. Defaults to true.
- {LABKEY.Domain.DomainDesign} config.domainDesign
- The domain design to save.
- {Object} config.options Optional
- Arguments used to create the specific domain type.
- {String} config.containerPath Optional
- The container path in which to create the domain.
<static>
LABKEY.Domain.drop(config, config)
Delete a domain.
- Parameters:
- config
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success.
- {Function} config.failure Optional
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
<static>
LABKEY.Domain.get(config)
This api is deprecated, use LABKEY.Domain.getDomainDetails instead.
Example:<script type="text/javascript"> function successHandler(domainDesign) { var html = ''; html += '<b>' + domainDesign.name + ':</b><br> '; for (var i in domainDesign.fields) { html += ' ' + domainDesign.fields[i].name + '<br>'; } document.getElementById('testDiv').innerHTML = html; } function errorHandler(error) { alert('An error occurred retrieving data: ' + error); } LABKEY.Domain.get(successHandler, errorHandler, 'study', 'StudyProperties'); </script> <div id='testDiv'>Loading...</div>
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required. Function called if the "get" function executes successfully. Will be called with the argument LABKEY.Domain.DomainDesign, which describes the fields of a domain.
- {Function} config.failure Optional
- Function called if execution of the "get" function fails.
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.domainId
- Id of the domain. This is an alternate way to identify the domain. SchemaName and queryName will be ignored if this value is not undefined or null.
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
<static>
LABKEY.Domain.getDomainDetails(config)
Gets a domain design along with domain kind specific properties.
Example:<script type="text/javascript"> function successHandler(domainDesign) { var html = ''; html += '<b>' + domainDesign.name + ':</b><br> '; for (var i in domainDesign.fields) { html += ' ' + domainDesign.fields[i].name + '<br>'; } document.getElementById('testDiv').innerHTML = html; } function errorHandler(error) { alert('An error occurred retrieving data: ' + error); } LABKEY.Domain.getDomainDetails(successHandler, errorHandler, 'study', 'StudyProperties'); </script> <div id='testDiv'>Loading...</div>
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required. Function called if the "getDomainDetails" function executes successfully. Will be called with the argument LABKEY.Domain.DomainDesign, which describes the fields of a domain.
- {Function} config.failure Optional
- Function called if execution of the "getDomainDetails" function fails.
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.domainId
- Id of the domain. This is an alternate way to identify the domain. SchemaName and queryName will be ignored if this value is not undefined or null.
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
<static>
LABKEY.Domain.getProperties(config)
Get property descriptor information.
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success Optional
- Success callback is a function that is called with an array of property information in the same format as 'fields' within LABKEY.Domain.DomainDesign.
- {Function} config.failure Optional
- Failure callback.
- {Array} config.propertyIds
- Array of integer propertyIds.
- {Array} config.propertyURIs
- Array of string propertyURIs.
- {String} config.containerPath
- Container path of the property definitions.
<static>
LABKEY.Domain.listDomains(config)
Lists all the domains within a given container. Specify domain kinds to get the targeted list of domain kinds.
List domains:LABKEY.Domain.listDomains({ includeFields: "true", domainKinds: ["ExtensibleTable", "Vocabulary"] });
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required success callback.
- {Function} config.failure Optional
- Failure callback.
- {Boolean} config.includeFields
- Include Fields of in the list of domains. Defaults to false.
- {Boolean} config.includeProjectAndShared
- Includes domains in projects and shared. Defaults to false.
- {Array} config.domainKinds
- The list of domain Kinds to include in the list. Defaults to all the domains in container.
- {String} config.containerPath
- Container path of the domains holding container.
<static>
LABKEY.Domain.save(config)
Saves the provided domain design.
Note: All of the domain properties are expected to be present before saving, and not just the diff - the easiest way
is to get the existing domain via LABKEY.Domain.getDomainDetails and update the resultant json with your changes before saving.
- Parameters:
- {Object} config
- An object which contains the following configuration properties.
- {Function} config.success
- Required. Function called if this function executes successfully. No parameters will be passed to the success callback.
- {Function} config.failure Optional
- Function called if execution of this function fails.
- {LABKEY.Domain.DomainDesign} config.domainDesign
- The domain design to save.
- {String} config.schemaName
- Name of the schema
- {String} config.queryName
- Name of the query
- {String} config.domainId
- Id of the domain. This is an alternate way to identify the domain to update. SchemaName and queryName will be ignored if this value is not undefined or null.
- {String} config.containerPath Optional
- The container path in which the requested Domain is defined. If not supplied, the current container path will be used.
- {boolean} config.includeWarnings
- set this to true, if server side warnings are desired along with the errors If this is set to true and there are warnings detected, they will prevent the save from completing successfully
- {Object} config.options Optional
- Domain Kind specific properties. If not supplied, will be ignored. Note: Certain domain kind specific properties are read-only and cannot be updated. Read-only properties for 'IntList' & 'VarList' domain kinds: listId, domainId, keyName, keyType, and lastIndexed.