Skip to main content

Overview

Apply confirmed decisions from the review process to the knowledge graph. Merges approved duplicate entities and removes rejected relations, then updates the graph file.

Usage

Options

string
Output directory containing graph and review files. Use -o as shorthand.
boolean
default:"false"
Enable verbose logging. Use -v as shorthand.

Behavior

Application Process

  1. Load Graph - Reads graph_data.json
  2. Apply Entity Merges - Processes confirmed proposals from merge_proposals.yaml
    • Merges entity attributes
    • Redirects all relations to canonical entity
    • Removes duplicate entities
  3. Apply Relation Rejections - Removes rejected relations from relation_review.yaml
  4. Save Graph - Updates graph_data.json with changes

Entity Merge Logic

When merging entities:
  • Canonical Name - Uses name from merge proposal
  • Attributes - Combines attributes from all merged entities
  • Relations - Redirects all incoming/outgoing relations to canonical entity
  • Source Documents - Preserves references from all merged entities

Relation Rejection

Removes relations marked as status: rejected in relation_review.yaml.

Input Files

merge_proposals.yaml

Reads the confirmed section:

relation_review.yaml

Reads relations with status: rejected:

Output

Updates graph_data.json with:
  • Merged entities
  • Removed duplicate entities
  • Removed rejected relations
  • Updated entity and relation counts

Examples

Apply all confirmed decisions

Applies all confirmed merges and rejections from review files.

Apply from custom directory

Applies decisions from specified output directory.

With verbose logging

Shows detailed merge operations.

Output Summary

Displays:
  • Number of entity merges applied
  • Number of relations rejected
  • Final entity count
  • Final relation count
  • Graph file location

No Changes

If no confirmed merges or rejections exist:

Next Steps

After applying merges:
To generate a narrative summary of the updated knowledge graph.

Iterative Workflow

The review-apply cycle can be repeated:
  1. sift resolve - Find more duplicates
  2. sift review - Review new proposals
  3. sift apply-merges - Apply decisions
  4. Repeat as needed

Error Handling

Exits with error if:
  • No graph_data.json found (run sift build first)
  • Review files are malformed

Rollback

To undo applied merges:
  • Restore graph_data.json from backup
  • Or rebuild graph from extractions: sift build

See Also

  • review - Review merge proposals
  • resolve - Find duplicate entities
  • narrate - Generate narrative summary