Back to tutorials

Federate a Vault

advanced 30 minutes

What You’ll Build

A federated connection between two aDNA instances — exporting a lattice from one project, importing it into another, and composing it into a larger workflow. By the end, you’ll understand the full federation lifecycle.

Prerequisites

Steps

Step 1: Prepare the Source Lattice

Start with a lattice in your project that you want to share. Run the federation readiness checklist:

#CheckCommand/Action
1Schema validpython what/lattices/tools/lattice_validate.py my_lattice.lattice.yaml
2Shareable opt-inSet federation.shareable: true
3Source instanceSet federation.source_instance: my_project
4LicenseSet fair.license: "MIT" (or your choice)
5KeywordsSet fair.keywords: [at-least-one]
6References resolveCheck all ref fields — replace local paths with lattice:// URIs

Step 2: Convert Local References to URIs

Any ref field pointing to a local path needs to become a lattice:// URI for cross-instance use:

# Before (local)
ref: "what/modules/module_data_cleaner"

# After (federable)
ref: "lattice://my_project/data_cleaner_module"

URI format: lattice://<instance_id>/<lattice_name>[/<node_id>]

Step 3: Export

Export the lattice using the CLI (if available) or copy the .lattice.yaml file:

latlab lattice publish my_lattice.lattice.yaml

The publish command validates, registers in the local registry, and makes it available for pull.

Step 4: Import into the Target Project

In the target project:

latlab lattice pull my_lattice

This downloads the lattice and runs ontology unification — checking that the source’s entity types are compatible with the target’s. If conflicts exist, the 4-step merge algorithm resolves them (§11.3).

Step 5: Compose into a Larger Workflow

Now compose the imported lattice into a parent workflow. You have two options:

External reference (recommended — minimal token cost):

nodes:
  - id: data_analysis
    type: module
    ref: "lattice://my_project/data_analysis"
    description: "Imported data analysis pipeline"

edges:
  - from: data_collection
    to: data_analysis
    label: "raw data for analysis"
    data_mapping:
      raw_data: collect_data_input
    port: collect_data    # child entry node

Inline composition (when you need access to child internals):

latlab lattice compose parent.lattice.yaml child.lattice.yaml --pattern inline --seam-edges '[{"from":"parent_node","to":"child_entry"}]'

Step 6: Validate the Composition

Run the validator on the composed parent:

python what/lattices/tools/lattice_validate.py parent.lattice.yaml

Check: all seam edges have data_mapping, all lattice:// URIs resolve, no orphaned nodes.

Step 7: Set Version Policy

Choose how the target tracks source updates:

PolicySet When
lockedProduction: no surprises
patchStable: accept bug fixes
minorActive development: accept features
latestExperimental: always latest
federation:
  version_policy: minor

What You Learned

  • Federation is a 5-step lifecycle: validate → export → share → import → compose (§11)
  • FAIR metadata is the trust gate — no license, no federation
  • External reference is the default composition pattern — minimal token cost
  • Version policies manage dependency drift between source and target

Next Steps