Skip to content

Add ontology core: typed objects, evidence-backed links, SQLite/PostgreSQL store - #1

Merged
Zacharon merged 1 commit into
mainfrom
feature/ontology-core
Oct 19, 2026
Merged

Zacharon merged 1 commit into
mainfrom
feature/ontology-core

Conversation

@Zacharon

Copy link
Copy Markdown
Owner

Requested by Zach · project thread

Before: Forge had no shared object model. Events lived as NormalizedOSINTEvent rows in SQLite, and the memory graph existed only in memory, so there was nothing durable for Live Map to read.

After: Forge has an ontology store for typed objects: events, places, organizations, vessels, aircraft, facilities, sources, documents, observations, claims, assessments and requirements. Objects are joined by typed, time-bounded links, and every analytic link must cite evidence. Each object keeps its full revision history and an audit log, in SQLite (no extra packages) or PostgreSQL.

This is step 3 of the roadmap: the record store Live Map will become a client of. The vocabulary follows Live Map's CONTEXT.md.

How:

  • osint_forge/ontology/model.py: OntologyObject and OntologyLink with validation.
    • Ids are type:key, and every object needs provenance.
    • Coordinates must come as a pair; (0,0) is a valid point, not a missing one.
    • There is no person type, per the legal source policy.
    • Analytic links (supports, contradicts, mentions, same_as, …) must cite evidence. possible_association is capped at 0.5 confidence.
    • Retrieval timestamps are excluded from the content hash.
  • osint_forge/ontology/store.py: one store contract with SQLiteOntologyStore and PostgresOntologyStore. It covers revisioned upserts and history, type/text/bbox listing, link writes that refuse unknown endpoints or evidence, links_for, a neighborhood expansion for link-analysis views, and an audit log.
  • Schemas live in osint_forge/ontology/sql/ (SQLite, plus PostgreSQL migration 001). PostGIS indexing comes in a later migration.
  • tests/test_ontology.py: 20 tests. One shared contract suite runs against both backends.
  • CI gains a PostgreSQL 16 service job and moves to actions/checkout@v5 / setup-python@v6, since the old versions used the deprecated Node 20.
  • psycopg is an optional extra (osint-forge[postgres]). The core stays dependency-free.

Verified locally: 107 tests pass. The 20 ontology tests also pass against a local PostgreSQL 16 server.

Not in this PR: the HTTP API and Live Map feed, migrating existing events and memory-graph data onto these objects, and entity resolution.


Generated by Claude Code

…reSQL store

Objects are revisioned by content hash with full history and an audit log.
Analytic links must cite evidence already in the store; there is no person
object type, per the legal source policy. Both backends share one contract
test suite, and CI now runs it against PostgreSQL 16.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcagdBzPRAWDhhc9Yipm4d
@Zacharon Zacharon self-assigned this Oct 19, 2026
@Zacharon
Zacharon marked this pull request as ready for review October 19, 2026 04:48
@Zacharon
Zacharon merged commit aef17d7 into main Oct 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants