How you back an Ontology link type decides how users edit it and what breaks if you change it later. Palantir's Create a link type documentation offers three backing options: foreign keys, join table datasets and backing object types.
Workshop apps, action types and Search Arounds all depend on these choices. Palantir's edit documentation warns: "Editing a link type can have application-breaking consequences that can disrupt user workflows." This guide covers three things:
- what each option is for
- how to edit links through actions
- how to rework a link you modeled wrong
Before you start: decide whether users will edit the relationship. Palantir says: "A many-to-many cardinality, which requires a backing datasource, is required to enable users to edit or write back to the link type."
What a link type is
The link types overview says: "A link type is the schema definition of a relationship between two object types. A link refers to a single instance of that relationship between two objects in the same Ontology."
Three points from that page shape your design:
- One link type covers both directions. Palantir says a single link type already supports traversal both ways through its two sides, so you do not define a reverse link type. Each side has its own display name and API name.
- Self-links are allowed. The docs give this example: "A link type Direct Report ↔ Manager can be defined between the Employee object type and itself."
- No cross-Ontology links. "Links between object types across different Ontologies are not supported. In this case, you may prefer to leverage a shared Ontology."
You can have more than one link type between the same pair. Palantir says: "You can define multiple, distinct link types between the same two object types, but each one represents a separate real-world relationship rather than a reverse direction of an existing one." It adds: "Each link type requires unique API names on its sides so applications can distinguish between the relationships."
In TSv1 code, the docs show `flight.assignedAircraft.get()` and `aircraft.flights.all()` traversing the two sides of one link type.
Option 1: a foreign key (one-to-one, one-to-many)
Palantir defines it this way: "A foreign key is a property on one object type that stores the value of another object type's primary key, representing a real-world relationship between the two object types." In the docs' example, Tail Number is the primary key on Aircraft and Flight Tail Number is the foreign key on Flight.
The link dialog detects a foreign key automatically when two conditions hold:
- "The foreign key matches the primary key of the linked object type."
- "The property types of both objects match."
Do not lean on one-to-one. The docs say: "The one-to-one cardinality serves as an indicator of the intended relationship, but the one-to-one cardinality is not enforced."
Option 2: a join table (many-to-many)
For many-to-many, the docs say: "Select a dataset that contains columns matching the primary keys for both selected object types. A column can only be mapped to one primary key."
The data sits in a different place from a foreign key link. The overview says: "In the case of link types where object types are related with a many-to-many cardinality, datasources back the link types themselves."
This is the option that supports writeback to the link type itself, under the requirement quoted above.
You do not need production data on day one. The docs say: "The Generate join table option will create a dataset with the correct schema based on the primary keys of the two object types you have selected. This means that you can get started faster if you have user edit-backed data, or if you want to provide production data later on."
Option 3: promote the link to an object
A backing object type lets the relationship carry its own data. Palantir says: "Object-backed link types allow for the inclusion of additional metadata on the link and support restricted views."
The docs use a Flight Manifest example: "Unlike a foreign key or data-set backed link, this Flight Manifest object can contain additional properties such as Pilot and First Mate to provide additional metadata on the link."
You need three things in place before you build one, according to the docs: the two object types, the backing object type, and a many-to-one link type between each side and the backing object type.
Palantir says: "Currently, object-backed link types can be viewed in Object Explorer, Vertex, and Workshop."
We think the rule of thumb is simple. If you want a date, a role or a status on the relationship itself, the relationship has become a thing in its own right and belongs in a backing object.
Editing links through actions
The action type rules documentation handles foreign key links and many-to-many links differently.
For a foreign key link:
- Add an object rule that changes the foreign key property. Palantir says: "To create or delete one-to-many or one-to-one links, object rules need to be used and the foreign key property on the object needs to be modified."
- If the object is new in the same action, do not use Modify object(s). The docs say of that rule: "This cannot reference an object created as a part of the current action." They list Create or modify object(s) as the alternative.
For a many-to-many link:
- Add a Create link(s) or Delete link rule. The docs say both work between objects passed in through object reference parameters.
- Pass only object references. The docs say rules on links can only take object reference parameters.
- To create an object and its link together, start with a Create object rule on an object type that has a many-to-many link. The docs say: "Then click the Add link button below Add property to select the link type and configure the links."
If you reach for Create link(s) on a foreign key link, the docs redirect you: "For foreign key links, one has to use the Modify object rule to explicitly modify the foreign key property."
There are ordering constraints too. "Objects cannot be deleted before they are added or modified. Objects cannot be modified before they are added. Objects cannot be created twice in one form submission."
There is also a code route. The docs say of the function rule: "When this rule is present, no other rule may be configured since function code alone is capable of handling everything that other rules can do." To stop bad links before they land, see our guide to guarding action types with submission criteria.
Changing your mind later
Palantir lists four changes that unregister and reregister, or delete, the backing datasource:
- changing a many-to-many link type's backing datasource
- changing the cardinality of a link type
- changing the foreign key of a link type
- deleting a link type
The docs say links of that type are unavailable during the reindex. They also say a Workshop app that uses the link type in a search around stays broken until the reindex completes. "You can track the progress of the reindex for a link type in the Phonograph pane of its Datasources page."
Writeback raises the stakes. Palantir's documentation describes this for Object Storage v1 (Phonograph): "The history of edits made to a link type is stored in Object Storage v1 (Phonograph)." It continues: "When the backing datasource of a link type is unregistered from Object Storage v1 (Phonograph), the history of edits in Object Storage v1 (Phonograph) is deleted and future builds of the writeback dataset will fail."
If you need metadata on a link you already built, the docs give a path: "Existing links can be converted to object-backed link types." First meet the object-backed prerequisites above, then:
- Open the link in Ontology Manager.
- In the Configuration section, update the join method and select Object type.
- Select the backing object type in the Update link type to object-backed link type dialog.
- Select the link type from the link edges to the backing object in the same dialog.
- Select Update to object-backed.
For background on how Ontology changes move to main, see our explainer on global branches. Our sync failures guide covers what to check after a change lands.
Watch out for
In our view, these anti-patterns cause the most pain. Each one rests on a behavior Palantir documents.
- Guessing at cardinality. Changing it later triggers a reindex. Decide up front whether a Flight can ever have two Aircraft.
- Renaming join table columns after edits. Palantir's documentation for Object Storage v1 (Phonograph) says a writeback link type needs unregistering after a schema change to any backing column if it has ever received edits, even if it receives none now. Renaming a column or changing its base type counts. The docs say this does not happen automatically: the reindex fails until you undo the change or manually unregister and reregister the datasource.
- Reusing one dataset for two link types. The docs say this returns `Phonograph2:DatasetAndBranchAlreadyRegistered`, because the datasource already backs a different link type.
- Swapping datasources with a different schema. "Keys will be automatically remapped for you only if you change to a new datasource with the same schema as the old datasource. Otherwise, you will need to remap the keys to the new datasource."
- Treating API names as draft. "You cannot change the API name for link types with an active status." Also: "Link types with an active status cannot be deleted."
- Relying on one-to-one. It is not enforced, so check it in your pipeline or actions.
- Defining reverse link types. One link type already has two sides.
What to settle first
We think the decisions to get right before the first edit lands are cardinality, the foreign key and API names. Palantir documents that changing cardinality or the foreign key later unregisters the backing datasource and forces a reindex. Once a link type is active, its API name cannot change at all.
For background, Palantir's November 10 announcement of Search Around V2 in Vertex says: "Choose which link types and directions to follow, then narrow your results with filters on objects and object-backed links." For where Workshop apps fit, see our Workshop explainer.
