Overview
Construct a knowledge graph from previously extracted entities and relations. Merges duplicate entities, normalizes entity types, removes redundancy, and flags low-confidence relations for review.Usage
Options
string
Path to custom domain YAML file. Used to check review-required relation types and entity normalization.
string
default:"schema-free"
Bundled domain name (e.g.,
general, osint, academic). Use -d as shorthand.string
Output directory containing extraction results. Use
-o as shorthand. Defaults to config value.float
default:"0.7"
Confidence threshold for flagging relations. Relations with confidence below this value are flagged for manual review.
boolean
default:"false"
Skip redundancy removal and graph cleanup. Use when you want raw extraction results without normalization.
boolean
default:"false"
Enable verbose logging. Use
-v as shorthand.Behavior
Graph Building Process
- Load Extractions - Reads all extraction JSON files from
{output_dir}/extractions/ - Entity Normalization - Applies domain-specific canonical name mappings
- Relation Validation - Checks relation types against domain schema (if applicable)
- Redundancy Removal - Removes duplicate relations and normalizes entity references (unless
--no-postprocess) - Confidence Flagging - Flags low-confidence relations and review-required types
Schema-Free Mode
If using schema-free domain, loads discovered schema fromdiscovered_domain.yaml (created during extraction) for normalization.
Output Files
graph_data.json
The built knowledge graph in JSON format containing:- All entities with attributes and metadata
- All relations with confidence scores
- Source document references
{output_dir}/graph_data.json
relation_review.yaml
Generated if relations are flagged for review. Contains:- Relations below confidence threshold
- Relations with types marked
review_requiredin domain config - Fields:
source_id,target_id,relation_type,confidence,status
{output_dir}/relation_review.yaml
Examples
Basic build
Custom review threshold
Skip post-processing
With custom domain
Output Summary
Displays:- Total entities in graph
- Total relations in graph
- Number of relations flagged for review
- Output file location
Next Steps
After building the graph:Error Handling
The command exits with error if:- No extraction files found in
{output_dir}/extractions/ - Output directory doesn’t exist