Skip to content

Models

FactDb uses ActiveRecord models for data persistence.

Core Models

  • Source - Immutable source content
  • Entity - Resolved identities with aliases
  • Fact - Temporal assertions

Supporting Models

EntityAlias

Stores alternative names for entities.

class EntityAlias < ActiveRecord::Base
  belongs_to :entity
end
Column Type Description
entity_id bigint Parent entity
name string Alternative name
type string Type (nickname, abbreviation, etc.)
confidence float Match confidence

EntityMention

Links facts to mentioned entities.

class EntityMention < ActiveRecord::Base
  belongs_to :fact
  belongs_to :entity
end
Column Type Description
fact_id bigint Parent fact
entity_id bigint Referenced entity
mention_text string How entity was mentioned
mention_role string Role (subject, object, etc.)
confidence float Resolution confidence

FactSource

Links facts to source content.

class FactSource < ActiveRecord::Base
  belongs_to :fact
  belongs_to :source
end
Column Type Description
fact_id bigint Parent fact
source_id bigint Source content
kind string Kind (primary, supporting, corroborating)
excerpt text Relevant text excerpt
confidence float Source confidence

Model Relationships

erDiagram
    Source ||--o{ FactSource : "sourced by"
    Entity ||--o{ EntityAlias : "has"
    Entity ||--o{ EntityMention : "mentioned in"
    Fact ||--o{ EntityMention : "mentions"
    Fact ||--o{ FactSource : "sourced from"