Sign In

aif-core-compliance

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aif-core-compliance

AIF Core compliance validator for AIF.sql-shaped JSON with strict Upper Ontology and Forms fulfilment checks.

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

aif-core-compliance

AIF Core (Definition 1.1) compliance validator for AIF.sql-shaped JSON.

This package validates:

  • Input shape with JSON Schema (aif-sql-core-strict profile)
  • Reference integrity (REF_*)
  • Simple digraph constraints (NO_SELF_LOOPS, NO_DUPLICATE_EDGES)
  • Upper Ontology constraints
  • Forms Ontology fulfilment (strict)

Scope

  • Target specification: AIF Core (Definition 1.1)
  • Input format: AIF.sql-homomorphic JSON (table arrays)
  • Validation mode: strict
  • Entry points: library API and CLI (aif-core-compliance)

Input Format Contract

validate(doc) expects one JSON object with all of the following required top-level keys:

  • nodes
  • edges
  • schemes
  • schemeFulfillment
  • descriptors
  • descriptorFulfillment
  • formEdges
  • formEdgeTypes

Top-level additional keys are not allowed by schema.

Row Shapes

nodes[]

  • nodeID: integer (>=1)
  • text: string
  • type: "I" | "RA" | "CA" | "PA"
  • timestamp?: string

edges[]

  • edgeID: integer (>=1)
  • fromID: integer (>=1)
  • toID: integer (>=1)
  • formEdgeID: integer (>=1) | null

schemes[]

  • schemeID: integer (>=1)
  • name: string
  • schemeTypeID: integer (>=1)

schemeFulfillment[]

  • nodeID: integer (>=1)
  • schemeID: integer (>=1)

descriptors[]

  • descriptorID: integer (>=1)
  • text: string

descriptorFulfillment[]

  • nodeID: integer (>=1)
  • descriptorID: integer (>=1)

formEdges[]

  • formEdgeID: integer (>=1)
  • schemeID: integer (>=1)
  • formEdgeTypeID: integer (>=1)
  • name: string
  • descriptorID: integer (>=1) | null
  • schemeTarget: integer (>=1) | null

formEdgeTypes[]

  • formEdgeTypeID: integer (>=1)
  • name: string
  • direction: "IN" | "OUT"

Strict Semantics Notes

  • edges.formEdgeID may be null in schema, but strict validation raises EDGE_ROLE_REQUIRED when that edge is incident to an S-node (RA/CA/PA).
  • formEdges.descriptorID and formEdges.schemeTarget may be null in schema and are checked by strict fulfilment rules when present.

Minimal Input Example

See examples/valid/minimal.json.

{
  "nodes": [
    { "nodeID": 1, "text": "Premise", "type": "I" },
    { "nodeID": 2, "text": "Apply RA", "type": "RA" },
    { "nodeID": 3, "text": "Conclusion", "type": "I" }
  ],
  "edges": [
    { "edgeID": 1, "fromID": 1, "toID": 2, "formEdgeID": 1 },
    { "edgeID": 2, "fromID": 2, "toID": 3, "formEdgeID": 2 }
  ],
  "schemes": [{ "schemeID": 1, "name": "Basic Inference", "schemeTypeID": 1 }],
  "schemeFulfillment": [{ "nodeID": 2, "schemeID": 1 }],
  "descriptors": [],
  "descriptorFulfillment": [],
  "formEdges": [
    {
      "formEdgeID": 1,
      "schemeID": 1,
      "formEdgeTypeID": 1,
      "name": "premise",
      "descriptorID": null,
      "schemeTarget": null
    },
    {
      "formEdgeID": 2,
      "schemeID": 1,
      "formEdgeTypeID": 2,
      "name": "conclusion",
      "descriptorID": null,
      "schemeTarget": null
    }
  ],
  "formEdgeTypes": [
    { "formEdgeTypeID": 1, "name": "incoming", "direction": "IN" },
    { "formEdgeTypeID": 2, "name": "outgoing", "direction": "OUT" }
  ]
}

Install

npm install aif-core-compliance

Library API

import { validate, type AifSqlDocument } from "aif-core-compliance";

const doc: AifSqlDocument = /* your input */;
const result = validate(doc);
// { compliant: boolean, issues: Issue[] }

Issue minimum fields:

  • id
  • severity
  • message
  • path (when available)

CLI

aif-core-compliance examples/valid/minimal.json
aif-core-compliance --json examples/invalid/edge_role_required.json

Exit codes:

  • 0: compliant
  • 1: non-compliant
  • 2: input/runtime error (read/parse/exception)

Profile Schema

schemas/aif-sql-core-strict.schema.json

Installed package path example:

  • node_modules/aif-core-compliance/schemas/aif-sql-core-strict.schema.json

Rule Catalog

Rule IDs and descriptions are in rules/catalog.json.

Examples

  • examples/valid/
  • examples/invalid/

Each invalid example has a paired expectation file:

  • examples/invalid/<name>.expected.json

Development

npm install
npm test
npm run build

FAQs

Package last updated on 19 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts