Skip to content

Class: LinkageCache

Pre-computed provenance closure table.

Stores every (ancestor, descendant) pair across all chain types with hop_depth.

Refreshed on a schedule; not real-time (acceptable for daily batch cadence).

__

DDL:

_ CREATE TABLE linkage_cache (_

_ ancestor_id UUID NOT NULL,_

_ descendant_id UUID NOT NULL,_

_ ancestor_type VARCHAR(64), -- 'sample' | 'processedSample' |_

_ -- 'DataProcessingActivity' | 'processedData'_

_ descendant_type VARCHAR(64),_

_ hop_depth INTEGER NOT NULL, -- 1 = direct parent_

_ path TEXT,_

_ computed_at TIMESTAMP DEFAULT now(),_

_ PRIMARY KEY (ancestor_id, descendant_id)_

_ );_

_ CREATE INDEX ON linkage_cache (descendant_id); -- reverse lookup_

__

Example — all products from sample S1:

_ SELECT pd.*_

_ FROM linkage_cache lc_

_ JOIN "processedData" pd ON pd.id = lc.descendant_id_

_ WHERE lc.ancestor_id = 'S1-uuid'_

_ AND lc.descendant_type = 'processedData';_

__

NOTE: ancestor_id + descendant_id form a composite PK in the DDL.

LinkML does not natively express composite PKs; a unique_key is defined

below as the closest equivalent.

URI: basalt_schema:LinkageCache

 classDiagram
    class LinkageCache
    click LinkageCache href "../LinkageCache/"
      LinkageCache : ancestor_id

      LinkageCache : ancestor_type

      LinkageCache : computed_at

      LinkageCache : descendant_id

      LinkageCache : descendant_type

      LinkageCache : hop_depth

      LinkageCache : path

Slots

Name Cardinality and Range Description Inheritance
ancestor_type 0..1
String
Class/table name of the ancestor node direct
descendant_type 0..1
String
Class/table name of the descendant node (same vocabulary as ancestor_type) direct
hop_depth 1
Integer
Number of hops between ancestor and descendant (1 = direct parent) direct
path 0..1
String
Optional debug string representing the full chain (e direct
computed_at 0..1
Datetime
Timestamp when this row was last computed by the refresh job direct
ancestor_id 1
Uuid
direct
descendant_id 1
Uuid
direct

Unique Keys

unique_ancestor_descendant

Unique key slots: ancestor_id, descendant_id

Identifier and Mapping Information

Schema Source

Mappings

Mapping Type Mapped Value
self basalt_schema:LinkageCache
native basalt_schema:LinkageCache

LinkML Source

Direct

name: LinkageCache
description: "Pre-computed provenance closure table.\nStores every (ancestor, descendant)\
  \ pair across all chain types with hop_depth.\nRefreshed on a schedule; not real-time\
  \ (acceptable for daily batch cadence).\n\nDDL:\n  CREATE TABLE linkage_cache (\n\
  \    ancestor_id      UUID NOT NULL,\n    descendant_id    UUID NOT NULL,\n    ancestor_type\
  \    VARCHAR(64),    -- 'sample' | 'processedSample' |\n                       \
  \             --  'DataProcessingActivity' | 'processedData'\n    descendant_type\
  \  VARCHAR(64),\n    hop_depth        INTEGER NOT NULL,  -- 1 = direct parent\n\
  \    path             TEXT,\n    computed_at      TIMESTAMP DEFAULT now(),\n   \
  \ PRIMARY KEY (ancestor_id, descendant_id)\n  );\n  CREATE INDEX ON linkage_cache\
  \ (descendant_id);  -- reverse lookup\n\nExample — all products from sample S1:\n\
  \  SELECT pd.*\n  FROM linkage_cache lc\n  JOIN \"processedData\" pd ON pd.id =\
  \ lc.descendant_id\n  WHERE lc.ancestor_id = 'S1-uuid'\n    AND lc.descendant_type\
  \ = 'processedData';\n\nNOTE: ancestor_id + descendant_id form a composite PK in\
  \ the DDL.\nLinkML does not natively express composite PKs; a unique_key is defined\n\
  below as the closest equivalent."
from_schema: https://emsl-computing.github.io/BASALT-Schema
slots:
- ancestor_type
- descendant_type
- hop_depth
- path
- computed_at
attributes:
  ancestor_id:
    name: ancestor_id
    from_schema: https://emsl-computing.github.io/BASALT-Schema/linkage_cache
    rank: 1000
    domain_of:
    - LinkageCache
    range: uuid
    required: true
  descendant_id:
    name: descendant_id
    from_schema: https://emsl-computing.github.io/BASALT-Schema/linkage_cache
    rank: 1000
    domain_of:
    - LinkageCache
    range: uuid
    required: true
unique_keys:
  unique_ancestor_descendant:
    unique_key_name: unique_ancestor_descendant
    unique_key_slots:
    - ancestor_id
    - descendant_id

Induced

name: LinkageCache
description: "Pre-computed provenance closure table.\nStores every (ancestor, descendant)\
  \ pair across all chain types with hop_depth.\nRefreshed on a schedule; not real-time\
  \ (acceptable for daily batch cadence).\n\nDDL:\n  CREATE TABLE linkage_cache (\n\
  \    ancestor_id      UUID NOT NULL,\n    descendant_id    UUID NOT NULL,\n    ancestor_type\
  \    VARCHAR(64),    -- 'sample' | 'processedSample' |\n                       \
  \             --  'DataProcessingActivity' | 'processedData'\n    descendant_type\
  \  VARCHAR(64),\n    hop_depth        INTEGER NOT NULL,  -- 1 = direct parent\n\
  \    path             TEXT,\n    computed_at      TIMESTAMP DEFAULT now(),\n   \
  \ PRIMARY KEY (ancestor_id, descendant_id)\n  );\n  CREATE INDEX ON linkage_cache\
  \ (descendant_id);  -- reverse lookup\n\nExample — all products from sample S1:\n\
  \  SELECT pd.*\n  FROM linkage_cache lc\n  JOIN \"processedData\" pd ON pd.id =\
  \ lc.descendant_id\n  WHERE lc.ancestor_id = 'S1-uuid'\n    AND lc.descendant_type\
  \ = 'processedData';\n\nNOTE: ancestor_id + descendant_id form a composite PK in\
  \ the DDL.\nLinkML does not natively express composite PKs; a unique_key is defined\n\
  below as the closest equivalent."
from_schema: https://emsl-computing.github.io/BASALT-Schema
attributes:
  ancestor_id:
    name: ancestor_id
    from_schema: https://emsl-computing.github.io/BASALT-Schema/linkage_cache
    rank: 1000
    alias: ancestor_id
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: uuid
    required: true
  descendant_id:
    name: descendant_id
    from_schema: https://emsl-computing.github.io/BASALT-Schema/linkage_cache
    rank: 1000
    alias: descendant_id
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: uuid
    required: true
  ancestor_type:
    name: ancestor_type
    description: "Class/table name of the ancestor node.\nExpected values: 'sample'\
      \ | 'processedSample' |\n                 'DataProcessingActivity' | 'processedData'"
    from_schema: https://emsl-computing.github.io/BASALT-Schema
    rank: 1000
    alias: ancestor_type
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: string
  descendant_type:
    name: descendant_type
    description: Class/table name of the descendant node (same vocabulary as ancestor_type)
    from_schema: https://emsl-computing.github.io/BASALT-Schema
    rank: 1000
    alias: descendant_type
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: string
  hop_depth:
    name: hop_depth
    description: Number of hops between ancestor and descendant (1 = direct parent).
      Named hop_depth rather than depth because slots.yaml already defines a global
      "depth" slot (MIxS soil/sediment sampling depth, a string with a metres pattern);
      that definition wins on import and would silently type this column as TEXT.
    from_schema: https://emsl-computing.github.io/BASALT-Schema
    rank: 1000
    alias: hop_depth
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: integer
    required: true
  path:
    name: path
    description: Optional debug string representing the full chain (e.g., 'WEA1->WEA2->WEA3')
    from_schema: https://emsl-computing.github.io/BASALT-Schema
    rank: 1000
    alias: path
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: string
  computed_at:
    name: computed_at
    description: Timestamp when this row was last computed by the refresh job
    from_schema: https://emsl-computing.github.io/BASALT-Schema
    rank: 1000
    alias: computed_at
    owner: LinkageCache
    domain_of:
    - LinkageCache
    range: datetime
unique_keys:
  unique_ancestor_descendant:
    unique_key_name: unique_ancestor_descendant
    unique_key_slots:
    - ancestor_id
    - descendant_id