Arke
Build

Relationships

How to create, query, and manage relationships between entities.

Overview

Relationships connect entities to each other. They're stored as part of the entity manifest and versioned along with everything else.

A relationship has:

  • predicate -- The type of connection (e.g. contains, parent, references)
  • peer -- The target entity ID
  • peer_type -- Optional type hint for the target
  • peer_label -- Optional display name
  • properties -- Optional metadata on the relationship itself

Creating Relationships

At Entity Creation

POST /entities
{
  "type": "file",
  "properties": { "name": "Document" },
  "collection_id": "01JCOL...",
  "relationships": [
    { "predicate": "parent", "peer": "01JFOLDER..." }
  ]
}

On an Existing Entity

PUT /entities/:id
{
  "expected_cid": "bafyreig...",
  "relationships_add": [
    { "predicate": "references", "peer": "01JOTHER..." }
  ]
}

Common Predicates

PredicateDirectionMeaning
containsParent → ChildParent contains the child entity
parentChild → ParentChild belongs to this parent
referencesAnyGeneral reference link
member_ofUser → CollectionUser membership in collection

Querying Relationships

Use the Argo query DSL for graph traversal:

@01JENTITY... -[contains]{,3}-> type:file

This starts at a specific entity and traverses up to 3 hops of contains relationships to find files.

See Argo Queries for the full query syntax.

On this page