Unit Hierarchy

Palantir Defense Ontology

[Palantir Defense Ontology] The structured representation of the relationships between a set of units.

Properties

Unit Hierarchy Id
string

[Palantir Defense Ontology] Uniquely identifies a unit hierarchy, which is a structured representation of the relationships between a set of units.

Unit Hierarchy Name
string

[Palantir Defense Ontology] Captures the name of a unit hierarchy.

Root Unit Ids
list<item>

[Palantir Defense Ontology] A list of root units in a unit hierarchy.

Unit Hierarchy Group Id
string

[Palantir Defense Ontology] Uniquely identifies a related group of unit hierarchies.

Unit Hierarchy Status
string

[Palantir Defense Ontology] Represents the current status of a Unit Hierarchy, whether it is Primary (canonical), Alternate, or Archived.

Unit Hierarchy Valid From
date

[Palantir Defense Ontology] Used to capture the start date of when a unit link or unit hierarchy is valid.

Unit Hierarchy Valid To
date

[Palantir Defense Ontology] Used to capture the end date of when a unit link or unit hierarchy is valid.

Source System Id
string

[Palantir Defense Ontology] Identifies the source system from which a data point derives.

One To Many
optional

[Palantir Defense Ontology] A unit hierarchy links to many unit hierarchy links to describe the relationships between units within a hierarchy.

[DEPRECATED] Plan
One To Many
optional

[Palantir Defense Ontology] The plans associated with the unit hierarchy

Code snippets

TypeScript

Load ordered Unit Hierarchy

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; import { isOk, type Osdk, type PageResult, type Result } from "@osdk/client"; const page: Result<PageResult<Osdk<com.palantir.defense.ontology.UnitHierarchy>>> = await client(com.palantir.defense.ontology.UnitHierarchy) .fetchPageWithErrors({ $orderBy: {"someProperty": "asc"}, $pageSize: 30 }); if (isOk(page)) { const interfaces = page.value.data; const interface1 = interfaces[0]; }

Load Unit Hierarchy metadata

Copied!
1 2 3 4 5 6 7 8 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; const interfaceTypeMetadata = await client.fetchMetadata(com.palantir.defense.ontology.UnitHierarchy); const implementingObjectTypes = interfaceTypeMetadata.implementedBy; const interfaceRid = interfaceTypeMetadata.rid;

Filtering

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; import { isOk, type Osdk, type PageResult, type Result } from "@osdk/client"; const page: Result<PageResult<Osdk<com.palantir.defense.ontology.UnitHierarchy>>> = await client(com.palantir.defense.ontology.UnitHierarchy) .where({ $and:[ { $not: { someProperty: { $isNull: true }}}, { someProperty: { $eq: "foo" }} ] }) .fetchPageWithErrors({ $pageSize: 30 }); if (isOk(page)) { const interfaces = page.value.data; const interface1 = interfaces[0]; }

Load all Unit Hierarchy

Copied!
1 2 3 4 5 6 7 8 9 10 11 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; import type { Osdk } from "@osdk/client"; const interfaces: Osdk<com.palantir.defense.ontology.UnitHierarchy>[] = []; for await(const int of client(com.palantir.defense.ontology.UnitHierarchy).asyncIter()) { interfaces.push(int); } const interface1 = interfaces[0];

Load pages of Unit Hierarchy

Copied!
1 2 3 4 5 6 7 8 9 10 11 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; import { type Osdk, type PageResult, type Result } from "@osdk/client"; const response: Result<PageResult<Osdk<com.palantir.defense.ontology.UnitHierarchy>>> = await client(com.palantir.defense.ontology.UnitHierarchy).fetchPageWithErrors({ $pageSize: 30 }); // To fetch a page without a result wrapper, use fetchPage instead const responseNoErrorWrapper: PageResult<Osdk<com.palantir.defense.ontology.UnitHierarchy>> = await client(com.palantir.defense.ontology.UnitHierarchy).fetchPage({ $pageSize: 30 });

Subscribe to object sets

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 import { com.palantir.defense.ontology.UnitHierarchy } from "@osdk/defense-ontology"; // Edit this import if your client location differs import { client } from "./client"; // A map of primary keys to objects loaded through the SDK const objects: { [key: string]: com.palantir.defense.ontology.UnitHierarchy.OsdkInstance } = ... const subscription = client(com.palantir.defense.ontology.UnitHierarchy).subscribe( { onChange(update) { if (update.state === "ADDED_OR_UPDATED") { // An object has received an update or an object was added to the object set const currentObject = objects[update.object.$primaryKey]; if (currentObject !== undefined) { currentObject["<propertyName>"] = update.object["<propertyName>"] ?? currentObject["<propertyName>"]; } } else if (update.state === "REMOVED") { // The object was removed from the object set, which could mean it was deleted or no longer meets the filter criteria delete objects[update.object.$primaryKey]; } }, onSuccessfulSubscription() { // The subscription was successful and you can expect to receive updates }, onError(err) { // There was an error with the subscription and you will not receive any more updates console.error(err); }, onOutOfDate() { // We could not keep track of all changes. Please reload the objects in your set. }, }, { properties: [ "com.palantir.defense.ontology.unitHierarchyId", "com.palantir.defense.ontology.unitHierarchyName", "com.palantir.defense.ontology.unitHierarchyRootUnitIds", "com.palantir.defense.ontology.unitHierarchyGroupId", "com.palantir.defense.ontology.unitHierarchyStatus", "com.palantir.defense.ontology.unitHierarchyValidFrom", "com.palantir.defense.ontology.unitHierarchyValidTo", "com.palantir.defense.ontology.sourceSystemId", ]} ); subscription.unsubscribe();