Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions knowledge-graph-ontology-drift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Knowledge Graph Ontology Drift

This module adds a focused Scientific Knowledge Graph Integration control for reviewing ontology release drift before graph data, recommendations, and linked entity pages are migrated.

## What it checks

- Deprecated ontology concepts still referenced by graph nodes or relationships
- Replacement concept validity
- Synonym collisions that can corrupt entity search or recommendation expansion
- Active recommendation paths that depend on deprecated concepts
- Relationship evidence freshness
- Migration actions for nodes, relationships, and recommendations
- Impact scoring and deterministic audit digest for graph review

## Run locally

```bash
npm run check
npm test
npm run demo
```

The sample data intentionally includes one deprecated concept still in use, a synonym collision, a stale recommendation path, and one relationship with stale evidence.
25 changes: 25 additions & 0 deletions knowledge-graph-ontology-drift/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

const sampleBundle = require("./sample-data.json");
const {
analyzeOntologyDrift,
} = require("./src/knowledge-graph-ontology-drift");

const result = analyzeOntologyDrift(sampleBundle);

console.log(`Ontology release: ${result.previousVersion} -> ${result.nextVersion}`);
console.log(`Decision: ${result.decision}`);
console.log(`Impact score: ${result.impactScore}`);
console.log(`Audit digest: ${result.auditDigest}`);
console.log("");
console.log("Migration actions:");
for (const action of result.migrationActions) {
console.log(`- ${action.type} ${action.targetId}`);
}
console.log("");
console.log("Findings:");
for (const finding of result.findings) {
console.log(`- [${finding.severity}] ${finding.id}: ${finding.title}`);
console.log(` detail: ${finding.detail}`);
console.log(` remediation: ${finding.remediation}`);
}
Binary file not shown.
14 changes: 14 additions & 0 deletions knowledge-graph-ontology-drift/docs/requirement-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Requirement Map

| Scientific Knowledge Graph requirement | Implementation |
| --- | --- |
| Linked scientific entities | `graphNodes` model papers, datasets, titles, types, and ontology concept identifiers. |
| Relationships and evidence | `relationships` include source/target nodes, relationship type, concept tags, DOI evidence, and evidence dates. |
| Entity normalization | Deprecated concept mappings produce explicit migration actions from old identifiers to replacement concepts. |
| Graph search and recommendations | Synonym collisions and stale recommendation paths are flagged before search expansion or recommendation reuse. |
| Recommendation provenance | Active recommendations record concept paths and are invalidated when those paths depend on deprecated concepts. |
| Ontology-backed governance | `analyzeOntologyDrift` returns findings, migration actions, impact score, release versions, and an audit digest. |

## Demo Video

The PR includes `docs/ontology-drift-demo.mp4`, a real terminal walkthrough running the local check, test, and demo scripts.
12 changes: 12 additions & 0 deletions knowledge-graph-ontology-drift/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "knowledge-graph-ontology-drift",
"version": "1.0.0",
"description": "Ontology drift migration controls for scientific knowledge graphs.",
"main": "src/knowledge-graph-ontology-drift.js",
"scripts": {
"check": "node --check src/knowledge-graph-ontology-drift.js && node --check test.js && node --check demo.js",
"test": "node test.js",
"demo": "node demo.js"
},
"license": "MIT"
}
79 changes: 79 additions & 0 deletions knowledge-graph-ontology-drift/sample-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"now": "2026-05-15T00:00:00.000Z",
"maxEvidenceAgeDays": 540,
"ontologyRelease": {
"previousVersion": "sci-kg-2026.04",
"nextVersion": "sci-kg-2026.06",
"concepts": [
{
"id": "concept:single-cell-rna-seq",
"label": "single-cell RNA sequencing",
"synonyms": ["scRNA-seq", "single cell transcriptomics"]
},
{
"id": "concept:spatial-transcriptomics",
"label": "spatial transcriptomics",
"synonyms": ["spatial RNA-seq", "spatial assay"]
},
{
"id": "concept:spatial-rnaseq-panel",
"label": "spatial RNA sequencing panel",
"synonyms": ["spatial assay"]
},
{
"id": "concept:quality-control-pipeline",
"label": "quality control pipeline",
"synonyms": ["QC workflow"]
}
],
"deprecatedConcepts": [
{
"oldId": "concept:single-cell-old",
"replacementId": "concept:single-cell-rna-seq",
"reason": "merged into normalized assay method concept"
}
]
},
"graphNodes": [
{
"id": "paper:10.5555/cell-atlas.2024",
"type": "paper",
"title": "Cross-lab cell atlas replication",
"conceptIds": ["concept:single-cell-old", "concept:quality-control-pipeline"]
},
{
"id": "dataset:atlas-v2",
"type": "dataset",
"title": "Atlas release v2",
"conceptIds": ["concept:single-cell-rna-seq", "concept:spatial-transcriptomics"]
}
],
"relationships": [
{
"id": "rel:paper-method-dataset",
"sourceId": "paper:10.5555/cell-atlas.2024",
"targetId": "dataset:atlas-v2",
"type": "uses-dataset",
"conceptIds": ["concept:single-cell-old"],
"evidenceDoi": "10.5555/cell-atlas.2024",
"evidenceDate": "2024-01-10T00:00:00.000Z"
},
{
"id": "rel:dataset-qc",
"sourceId": "dataset:atlas-v2",
"targetId": "paper:10.5555/cell-atlas.2024",
"type": "validated-by",
"conceptIds": ["concept:quality-control-pipeline"],
"evidenceDoi": "10.5555/qc-pipeline.2026",
"evidenceDate": "2026-04-15T00:00:00.000Z"
}
],
"recommendations": [
{
"id": "rec:reuse-atlas-v2",
"status": "active",
"conceptPath": ["concept:single-cell-old", "concept:quality-control-pipeline"],
"reason": "dataset reuse candidate for single-cell analysis"
}
]
}
Loading