Skip to main content

Overview

The unlink() method removes a directional relation between two resources. This is useful for cleaning up outdated connections or correcting mistakes.
Unlinking only removes the specified direction. If you created bidirectional links, you must unlink both directions separately.

Method Signature

Parameters

string
required
Source URI of the relation to remove
string
required
Target URI of the relation to remove

Examples

Remove Single Relation

Clean Up Outdated Relations

Remove All Relations for a Resource

Response

Error Responses

Relation Not Found

If the relation doesn’t exist, the operation succeeds silently (idempotent):

Use Cases

  1. Cleanup - Remove outdated or incorrect relations
  2. Refactoring - Update relations when resources move or change
  3. Maintenance - Clean up relations before deleting resources
  4. Corrections - Fix accidentally created relations

Best Practices

Always query relations with relations() before mass unlinking to avoid removing unexpected links.

Notes

  • Unlink is idempotent: removing a non-existent relation succeeds
  • Unlink only affects one direction: A → B unlink doesn’t affect B → A
  • Unlink does not delete resources: only removes the relation
  • Resources can still be found via semantic search after unlinking
  • link() - Create relations between resources
  • relations() - Query existing relations
  • rm() - Delete resources (does not auto-unlink)