Ontologies
Experimental
Warning
Preview: This service is experimental and may change or be removed in future releases.
Read-only access to deployed UiPath Ontologies and stateless validation of ontology artifact content. Ontologies are authored as solution resources, so the SDK does not create, change or delete them.
Methods¶
getAll()¶
getAll<
T>(options?:T):Promise<TextendsHasPaginationOptions<T> ?PaginatedResponse<OntologyGetResponse> :NonPaginatedResponse<OntologyGetResponse>>
Experimental
Warning
Preview: This method is experimental and may change or be removed in future releases.
Lists ontologies across every folder, or in one folder when folderKey or folderPath
is given, with optional search, state filter and pagination. Without pagination options,
every ontology is returned.
Each ontology includes its name, display name, lifecycle state, folder and audit fields.
Type Parameters¶
| Type Parameter |
|---|
T extends OntologyGetAllOptions |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
T |
Optional folder (omit to list every folder), search, state filter and pagination options |
Returns¶
Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<OntologyGetResponse> : NonPaginatedResponse<OntologyGetResponse>>
Promise resolving to the OntologyGetResponse list, or a paginated response when pagination options are provided
Example¶
import { Ontologies, OntologyState } from '@uipath/uipath-typescript/ontologies';
const ontologies = new Ontologies(sdk);
// Get all, across every folder
const all = await ontologies.getAll();
// In one folder
const inFolder = await ontologies.getAll({ folderKey: '<folderKey>' });
// In one folder, by its path
const byPath = await ontologies.getAll({ folderPath: 'Shared/Finance' });
// Search by name
const filtered = await ontologies.getAll({ search: 'ecommerce' });
// Only deployed ontologies
const deployed = await ontologies.getAll({ state: OntologyState.Deployed });
// Paginated
const page = await ontologies.getAll({ pageSize: 10 });
if (page.hasNextPage) {
const next = await ontologies.getAll({ cursor: page.nextCursor });
}
getById()¶
getById(
id:string,options?:OntologyGetByIdOptions):Promise<OntologyGetResponse>
Experimental
Warning
Preview: This method is experimental and may change or be removed in future releases.
Gets a single ontology by its ID.
First, get ontology IDs with ontologies.getAll().
Parameters¶
| Parameter | Type | Description |
|---|---|---|
id |
string |
Ontology ID (GUID) |
options? |
OntologyGetByIdOptions |
Optional folder to read from (folderKey or folderPath; a key wins); defaults to the configured folder |
Returns¶
Promise<OntologyGetResponse>
Promise resolving to the OntologyGetResponse, including the key of the folder it belongs to
Examples¶
const ontologies = new Ontologies(sdk);
const ontology = await ontologies.getById('<ontologyId>', { folderKey: '<folderKey>' });
console.log(ontology.state, ontology.folderKey);
const ontologies = new Ontologies(sdk);
const ontology = await ontologies.getById('<ontologyId>', { folderPath: 'Shared/Finance' });
getByName()¶
getByName(
name:string,options?:OntologyGetByNameOptions):Promise<OntologyGetResponse>
Experimental
Warning
Preview: This method is experimental and may change or be removed in future releases.
Gets a single ontology by its name.
In an app deployed with a solution, the name is redirected to the ontology the solution's resource overrides point to, so code can use the design-time name. An override that names a folder path reads from that folder.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
name |
string |
Ontology name (case-sensitive) |
options? |
OntologyGetByNameOptions |
Optional folder to read from (folderKey or folderPath; a key wins); defaults to the configured folder |
Returns¶
Promise<OntologyGetResponse>
Promise resolving to the OntologyGetResponse, including the key of the folder it belongs to
Examples¶
const ontologies = new Ontologies(sdk);
const ontology = await ontologies.getByName('<ontologyName>');
const ontologies = new Ontologies(sdk);
const ontology = await ontologies.getByName('<ontologyName>', { folderKey: '<folderKey>' });
console.log(ontology.id, ontology.state);
const ontologies = new Ontologies(sdk);
const ontology = await ontologies.getByName('<ontologyName>', { folderPath: 'Shared/Finance' });
validateArtifactContent()¶
validateArtifactContent(
fileName:string,content:string,mediaType:string,options?:OntologyValidateArtifactContentOptions):Promise<OntologyValidateArtifactContentResponse>
Experimental
Warning
Preview: This method is experimental and may change or be removed in future releases.
Validates artifact content without an ontology and without storing anything.
Invalid content does not throw; check valid and violations in the result.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
fileName |
string |
Artifact filename (extension required, e.g. po-shapes.ttl) |
content |
string |
Raw artifact content to validate |
mediaType |
string |
MIME type of the content (e.g. text/turtle) |
options? |
OntologyValidateArtifactContentOptions |
Optional semantic type hint |
Returns¶
Promise<OntologyValidateArtifactContentResponse>
Promise resolving to the OntologyValidateArtifactContentResponse, including any violations
Examples¶
const ontologies = new Ontologies(sdk);
const result = await ontologies.validateArtifactContent('<fileName>.owl', '<content>', 'text/owl-functional');
console.log(result.valid);
import { Ontologies, OntologyArtifactType } from '@uipath/uipath-typescript/ontologies';
const ontologies = new Ontologies(sdk);
const result = await ontologies.validateArtifactContent(
'po-shapes.ttl',
'@prefix sh: … ',
'text/turtle',
{ type: OntologyArtifactType.Constraints }
);
if (!result.valid) {
result.violations.forEach(v => console.error(v.severity, v.message));
}