feat(openontology): implement OpenOntology Phase 0 + local engine and CLI

Implements OpenPRD 0001 through Phase 0 (specification, schemas, example,
docs surface) and Phase 1 (local engine, CLI, conformance tests).

Schemas (17 contracts, JSON Schema Draft 2020-12, additionalProperties:false)
  manifest, namespace, entity-type, property, relationship-type, constraint,
  query, action, entity, claim, source, evidence, changeset, review, approval,
  event, package — registered in @logicsrc/validators and exported from
  @logicsrc/schemas under https://logicsrc.com/schemas/openontology/.

@logicsrc/openontology
  - canonical JSON + sha256 package digests; YAML, JSON, NDJSON, and inline
    authoring all compile to the same bytes, so digests are authoring-agnostic
  - id profile: compact / IRI / urn with one canonicalization rule, prefix
    bound by a Namespace object so IRIs reverse unambiguously
  - validation: schema, graph (domain/range, datatypes, dangling refs),
    provenance (source-or-firstParty, agent runId, derivation inputs), policy
    (excerpt limits, licensing, visibility, staleness) and declared
    constraints; four severities, stable codes, text/json/yaml/markdown
  - portable triple-pattern query AST: multi-hop, 14 operators, asOf and
    recordedAsOf, per-status filtering, distinct/order/limit, explanation
    mode, and enforced depth/binding/row limits
  - append-only store: claims are immutable; dispute/retract/supersede append
    status transitions and the effective status is the latest one
  - change sets: 9 operations, atomic pre-flight, conflict detection on stale
    base revisions, semantic diff with duplicate-identity warnings and
    affected-query deltas, per-operation reviewer decisions
  - policy: agents propose but can never apply — the denial keys on actor
    type, so every scope plus high confidence plus --yolo still cannot apply;
    merges need approval, bulk retractions need two, undeclared action side
    effects are denied
  - JSON-LD 1.1 export/import with PROV-O aliases and lossy-field reporting
  - pluggable signature envelope with a jws-ed25519 reference profile and a
    fail-closed trust policy

CLI: logicsrc ontology init|validate|lint|build|inspect, entity, claim, query,
changeset, import, export, audit. Reads take --format, writes default to a
proposal, exit codes are stable for CI.

Example: examples/openontology/ethereum-ecosystem — 12 entity types, 17
relationship types, 63 entities, 169 claims, 25 sources, 31 evidence records,
5 saved queries, every claim lifecycle state, and a pending merge proposal.
All data is fictional; the directory is removable without affecting any core
test.

Docs: docs/openontology{,-governance,-interoperability}.md, a real
/openontology route, homepage + nav + sitemap entries, and a root README
section.

Verification: 112 new tests; full monorepo build and every workspace test
pass; conformance bundle (18 valid + 13 invalid fixtures) runs against the
published schemas alone; Node.js 25 and Bun 1.3 produce byte-identical
digests, revisions, event trails, and query results.

Not included (later PRD phases): MCP resources, REST/SSE, Turso adapter, TUI
and PWA surfaces, RDF/SHACL mappings, source adapters, governed actions.

Refs: prd/0001-add-logicsrc-openontology-spec.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-07-26 09:09:36 +00:00
parent 0d9dab0447
commit 444d1dbede
101 changed files with 11934 additions and 10 deletions

View file

@ -0,0 +1,158 @@
{
"openontologyConformance": "0.1",
"description": "Conformance fixtures for LogicSRC OpenOntology. A third-party implementation can run these against the published JSON Schemas with no LogicSRC code: every valid fixture must validate, every invalid fixture must fail.",
"valid": [
{
"fixture": "valid/manifest.json",
"kind": "openontology-manifest"
},
{
"fixture": "valid/namespace.json",
"kind": "openontology-namespace"
},
{
"fixture": "valid/entity-type.json",
"kind": "openontology-entity-type"
},
{
"fixture": "valid/property.json",
"kind": "openontology-property"
},
{
"fixture": "valid/relationship-type.json",
"kind": "openontology-relationship-type"
},
{
"fixture": "valid/constraint.json",
"kind": "openontology-constraint"
},
{
"fixture": "valid/query.json",
"kind": "openontology-query"
},
{
"fixture": "valid/query-adhoc.json",
"kind": "openontology-query"
},
{
"fixture": "valid/action.json",
"kind": "openontology-action"
},
{
"fixture": "valid/entity.json",
"kind": "openontology-entity"
},
{
"fixture": "valid/claim-relationship.json",
"kind": "openontology-claim"
},
{
"fixture": "valid/claim-value.json",
"kind": "openontology-claim"
},
{
"fixture": "valid/source.json",
"kind": "openontology-source"
},
{
"fixture": "valid/evidence.json",
"kind": "openontology-evidence"
},
{
"fixture": "valid/changeset.json",
"kind": "openontology-changeset"
},
{
"fixture": "valid/review.json",
"kind": "openontology-review"
},
{
"fixture": "valid/approval.json",
"kind": "openontology-approval"
},
{
"fixture": "valid/event.json",
"kind": "openontology-event"
}
],
"invalid": [
{
"fixture": "invalid/claim-both-objects.json",
"kind": "openontology-claim",
"mustFail": true,
"reason": "A claim object carries an entity reference or a typed value, never both."
},
{
"fixture": "invalid/claim-unknown-status.json",
"kind": "openontology-claim",
"mustFail": true,
"reason": "status must be one of the six declared claim states."
},
{
"fixture": "invalid/claim-confidence-out-of-range.json",
"kind": "openontology-claim",
"mustFail": true,
"reason": "confidence must be between 0 and 1."
},
{
"fixture": "invalid/claim-extra-property.json",
"kind": "openontology-claim",
"mustFail": true,
"reason": "Undeclared properties are rejected; extensions must go in the namespaced extensions object."
},
{
"fixture": "invalid/entity-missing-canonical-name.json",
"kind": "openontology-entity",
"mustFail": true,
"reason": "canonicalName is required on every entity."
},
{
"fixture": "invalid/manifest-no-maintainer.json",
"kind": "openontology-manifest",
"mustFail": true,
"reason": "At least one maintainer is required."
},
{
"fixture": "invalid/manifest-bad-version.json",
"kind": "openontology-manifest",
"mustFail": true,
"reason": "Package versions must be semantic versions."
},
{
"fixture": "invalid/manifest-bad-id.json",
"kind": "openontology-manifest",
"mustFail": true,
"reason": "Package ids are lowercase kebab-case."
},
{
"fixture": "invalid/relationship-no-range.json",
"kind": "openontology-relationship-type",
"mustFail": true,
"reason": "A relationship type must declare at least one allowed object type."
},
{
"fixture": "invalid/evidence-unknown-selector.json",
"kind": "openontology-evidence",
"mustFail": true,
"reason": "Evidence selectors must use one of the declared machine-readable shapes."
},
{
"fixture": "invalid/changeset-empty-operations.json",
"kind": "openontology-changeset",
"mustFail": true,
"reason": "A change set must contain at least one operation."
},
{
"fixture": "invalid/changeset-unknown-op.json",
"kind": "openontology-changeset",
"mustFail": true,
"reason": "Hard deletion is not an operation; use retract-claim or archive-entity."
},
{
"fixture": "invalid/action-no-permissions.json",
"kind": "openontology-action",
"mustFail": true,
"reason": "Actions must declare the scopes they require."
}
]
}

View file

@ -0,0 +1,13 @@
{
"openontology": "0.1",
"kind": "Action",
"id": "doThing",
"label": "Do thing",
"executor": {
"type": "http",
"endpoint": "https://example.org/do"
},
"approval": {
"mode": "none"
}
}

View file

@ -0,0 +1,10 @@
{
"openontology": "0.1",
"kind": "ChangeSet",
"id": "changeset:bad",
"title": "Nothing",
"createdAt": "2026-07-26T00:00:00Z",
"createdBy": "curator",
"operations": [],
"status": "proposed"
}

View file

@ -0,0 +1,15 @@
{
"openontology": "0.1",
"kind": "ChangeSet",
"id": "changeset:bad2",
"title": "Delete everything",
"createdAt": "2026-07-26T00:00:00Z",
"createdBy": "curator",
"operations": [
{
"op": "delete-claim",
"target": "ex:claim:0001"
}
],
"status": "proposed"
}

View file

@ -0,0 +1,14 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:bad",
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk",
"value": "ZK"
},
"status": "asserted",
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "curator"
}

View file

@ -0,0 +1,14 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:bad3",
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk"
},
"status": "asserted",
"confidence": 1.4,
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "curator"
}

View file

@ -0,0 +1,14 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:bad4",
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk"
},
"status": "asserted",
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "curator",
"chainOfThought": "first I considered..."
}

View file

@ -0,0 +1,13 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:bad2",
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk"
},
"status": "probably",
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "curator"
}

View file

@ -0,0 +1,8 @@
{
"openontology": "0.1",
"kind": "Entity",
"id": "ex:person:bob",
"type": "Person",
"createdAt": "2026-07-26T00:00:00Z",
"createdBy": "curator"
}

View file

@ -0,0 +1,10 @@
{
"openontology": "0.1",
"kind": "Evidence",
"id": "ex:evidence:bad",
"source": "ex:source:repo",
"selector": {
"type": "vibes",
"hint": "somewhere in the file"
}
}

View file

@ -0,0 +1,15 @@
{
"openontology": "0.1",
"kind": "OntologyPackage",
"id": "Example_Ontology",
"name": "Example",
"version": "0.1.0",
"namespace": "https://logicsrc.com/ontology/example/",
"description": "Id is not kebab-case.",
"license": "CC-BY-4.0",
"maintainers": [
{
"id": "mailto:c@example.org"
}
]
}

View file

@ -0,0 +1,15 @@
{
"openontology": "0.1",
"kind": "OntologyPackage",
"id": "example-ontology",
"name": "Example",
"version": "v1",
"namespace": "https://logicsrc.com/ontology/example/",
"description": "Version is not semver.",
"license": "CC-BY-4.0",
"maintainers": [
{
"id": "mailto:c@example.org"
}
]
}

View file

@ -0,0 +1,11 @@
{
"openontology": "0.1",
"kind": "OntologyPackage",
"id": "example-ontology",
"name": "Example",
"version": "0.1.0",
"namespace": "https://logicsrc.com/ontology/example/",
"description": "Missing maintainers.",
"license": "CC-BY-4.0",
"maintainers": []
}

View file

@ -0,0 +1,11 @@
{
"openontology": "0.1",
"kind": "RelationshipType",
"id": "worksOn",
"label": "works on",
"description": "Missing to.",
"from": [
"Person"
],
"to": []
}

View file

@ -0,0 +1,29 @@
{
"openontology": "0.1",
"kind": "Action",
"id": "createProjectReviewTask",
"label": "Create project review task",
"input": {
"project": {
"entityType": "Project",
"required": true
}
},
"executor": {
"type": "logicsrc-plugin-tool",
"plugin": "commandboard",
"tool": "task.create"
},
"permissions": {
"required": [
"ontology:action:execute"
]
},
"approval": {
"mode": "policy"
},
"sideEffects": [
"creates-task",
"emits-event"
]
}

View file

@ -0,0 +1,12 @@
{
"openontology": "0.1",
"kind": "Approval",
"id": "approval:0001",
"changeSet": "changeset:0001",
"approver": "mailto:curator@example.org",
"approverType": "human",
"scopes": [
"ontology:changeset:approve"
],
"createdAt": "2026-07-26T00:00:00Z"
}

View file

@ -0,0 +1,34 @@
{
"openontology": "0.1",
"kind": "ChangeSet",
"id": "changeset:0001",
"ontology": "example-ontology@0.1.0",
"title": "Add Alice as a contributor",
"rationale": "Repository activity identifies the contribution.",
"createdAt": "2026-07-26T00:00:00Z",
"createdBy": "agent:research-mapper",
"actorType": "agent",
"runId": "run_01J3EXAMPLE",
"operations": [
{
"op": "add-entity",
"value": {
"id": "ex:person:alice",
"type": "Person",
"canonicalName": "Alice Reyes"
}
},
{
"op": "assert-claim",
"value": {
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk"
}
}
}
],
"requiredApprovals": 1,
"status": "proposed"
}

View file

@ -0,0 +1,23 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:0001",
"ontology": "example-ontology@0.1.0",
"subject": "ex:person:alice",
"predicate": "worksOn",
"object": {
"entity": "ex:project:zk"
},
"status": "asserted",
"confidence": 0.94,
"validTime": {
"from": "2026-04-01T00:00:00Z",
"to": null
},
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "agent:research-mapper",
"runId": "run_01J3EXAMPLE",
"sources": [
"ex:source:repo"
]
}

View file

@ -0,0 +1,15 @@
{
"openontology": "0.1",
"kind": "Claim",
"id": "ex:claim:0002",
"subject": "ex:project:zk",
"predicate": "homepage",
"object": {
"value": "https://example.org/zk",
"datatype": "url"
},
"status": "asserted",
"assertedAt": "2026-07-26T00:00:00Z",
"assertedBy": "mailto:curator@example.org",
"firstParty": true
}

View file

@ -0,0 +1,12 @@
{
"openontology": "0.1",
"kind": "Constraint",
"id": "project-has-homepage",
"description": "Projects should record a homepage.",
"severity": "warning",
"rule": {
"type": "required-predicate",
"entityType": "Project",
"predicate": "homepage"
}
}

View file

@ -0,0 +1,16 @@
{
"openontology": "0.1",
"kind": "EntityType",
"id": "Person",
"label": "Person",
"description": "A human participant.",
"keyProperties": [
"canonicalName"
],
"properties": {
"role": {
"type": "string",
"required": false
}
}
}

View file

@ -0,0 +1,16 @@
{
"openontology": "0.1",
"kind": "Entity",
"id": "ex:person:alice",
"type": "Person",
"canonicalName": "Alice Reyes",
"aliases": [
"alice.eth"
],
"externalIds": {
"github": "alice"
},
"status": "active",
"createdAt": "2026-07-26T00:00:00Z",
"createdBy": "mailto:curator@example.org"
}

View file

@ -0,0 +1,17 @@
{
"openontology": "0.1",
"kind": "Event",
"id": "event:0001",
"type": "changeset.applied",
"ontology": "example-ontology",
"at": "2026-07-26T00:00:00Z",
"actor": "mailto:curator@example.org",
"actorType": "human",
"changeSet": "changeset:0001",
"revision": "data-000042",
"policyDecision": {
"rule": "apply.scope",
"decision": "allow",
"reason": "Actor holds ontology:claim:write"
}
}

View file

@ -0,0 +1,12 @@
{
"openontology": "0.1",
"kind": "Evidence",
"id": "ex:evidence:0001",
"source": "ex:source:repo",
"selector": {
"type": "line-range",
"start": 41,
"end": 48
},
"excerpt": "Alice authored the prover module."
}

View file

@ -0,0 +1,21 @@
{
"openontology": "0.1",
"kind": "OntologyPackage",
"id": "example-ontology",
"name": "Example Ontology",
"version": "0.1.0",
"namespace": "https://logicsrc.com/ontology/example/",
"description": "A minimal conforming package manifest.",
"license": "CC-BY-4.0",
"maintainers": [
{
"id": "mailto:curator@example.org"
}
],
"schema": {
"entityTypes": "schema/entity-types.yaml"
},
"data": {
"entities": "data/entities.ndjson"
}
}

View file

@ -0,0 +1,7 @@
{
"openontology": "0.1",
"kind": "Namespace",
"prefix": "ex",
"uri": "https://logicsrc.com/ontology/example/",
"description": "Compact prefix for the example package."
}

View file

@ -0,0 +1,8 @@
{
"openontology": "0.1",
"kind": "Property",
"id": "homepage",
"label": "homepage",
"description": "Canonical URL.",
"type": "url"
}

View file

@ -0,0 +1,16 @@
{
"openontologyQuery": "0.1",
"ontology": "example-ontology@0.1.0",
"match": [
{
"subject": "?person",
"predicate": "worksOn",
"object": "ex:project:zk"
}
],
"select": [
"?person"
],
"asOf": "2026-07-26T00:00:00Z",
"limit": 100
}

View file

@ -0,0 +1,24 @@
{
"openontology": "0.1",
"kind": "SavedQuery",
"id": "contributors",
"description": "People working on a project.",
"query": {
"match": [
{
"subject": "?person",
"predicate": "worksOn",
"object": "?project"
}
],
"select": [
"?person",
"?project"
],
"include": {
"claimStatus": [
"asserted"
]
}
}
}

View file

@ -0,0 +1,16 @@
{
"openontology": "0.1",
"kind": "RelationshipType",
"id": "worksOn",
"label": "works on",
"description": "A person contributes work to a project.",
"from": [
"Person"
],
"to": [
"Project"
],
"cardinality": "many-to-many",
"temporal": true,
"inverse": "hasContributor"
}

View file

@ -0,0 +1,17 @@
{
"openontology": "0.1",
"kind": "Review",
"id": "review:0001",
"changeSet": "changeset:0001",
"reviewer": "mailto:curator@example.org",
"state": "changes-requested",
"comment": "Second operation lacks a source.",
"createdAt": "2026-07-26T00:00:00Z",
"operationDecisions": [
{
"index": 1,
"decision": "reject",
"comment": "no evidence"
}
]
}

View file

@ -0,0 +1,13 @@
{
"openontology": "0.1",
"kind": "Source",
"id": "ex:source:repo",
"sourceType": "git-commit",
"uri": "https://example.org/repo/commit/abc123",
"title": "Repository commit",
"publisher": "example.org",
"retrievedAt": "2026-07-26T00:00:00Z",
"contentHash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"mediaType": "text/plain",
"license": "MIT"
}

View file

@ -1,7 +1,7 @@
{
"name": "@logicsrc/schemas",
"version": "0.1.0",
"description": "LogicSRC JSON schemas for tasks, agents, runs, events, plugins, and the AgentAd ad standard.",
"description": "LogicSRC JSON schemas for tasks, agents, runs, events, plugins, the AgentAd ad standard, and the OpenOntology knowledge contracts.",
"license": "MIT",
"type": "module",
"repository": {
@ -10,7 +10,18 @@
"directory": "packages/schemas"
},
"homepage": "https://github.com/profullstack/logicsrc/tree/master/packages/schemas",
"keywords": ["logicsrc", "agentad", "json-schema", "agents", "cli", "advertising", "standards"],
"keywords": [
"advertising",
"agentad",
"agents",
"cli",
"json-schema",
"knowledge-graph",
"logicsrc",
"ontology",
"openontology",
"standards"
],
"publishConfig": {
"access": "public"
},
@ -36,10 +47,29 @@
"./credential-provider": "./schemas/logicsrc-credential-provider.schema.json",
"./credential-sync-plan": "./schemas/logicsrc-credential-sync-plan.schema.json",
"./credential-sync-run": "./schemas/logicsrc-credential-sync-run.schema.json",
"./credential-audit-event": "./schemas/logicsrc-credential-audit-event.schema.json"
"./credential-audit-event": "./schemas/logicsrc-credential-audit-event.schema.json",
"./openontology-manifest": "./schemas/logicsrc-openontology-manifest.schema.json",
"./openontology-namespace": "./schemas/logicsrc-openontology-namespace.schema.json",
"./openontology-entity-type": "./schemas/logicsrc-openontology-entity-type.schema.json",
"./openontology-property": "./schemas/logicsrc-openontology-property.schema.json",
"./openontology-relationship-type": "./schemas/logicsrc-openontology-relationship-type.schema.json",
"./openontology-constraint": "./schemas/logicsrc-openontology-constraint.schema.json",
"./openontology-query": "./schemas/logicsrc-openontology-query.schema.json",
"./openontology-action": "./schemas/logicsrc-openontology-action.schema.json",
"./openontology-entity": "./schemas/logicsrc-openontology-entity.schema.json",
"./openontology-claim": "./schemas/logicsrc-openontology-claim.schema.json",
"./openontology-source": "./schemas/logicsrc-openontology-source.schema.json",
"./openontology-evidence": "./schemas/logicsrc-openontology-evidence.schema.json",
"./openontology-changeset": "./schemas/logicsrc-openontology-changeset.schema.json",
"./openontology-review": "./schemas/logicsrc-openontology-review.schema.json",
"./openontology-approval": "./schemas/logicsrc-openontology-approval.schema.json",
"./openontology-event": "./schemas/logicsrc-openontology-event.schema.json",
"./openontology-package": "./schemas/logicsrc-openontology-package.schema.json",
"./openontology-conformance": "./fixtures/openontology/conformance.json"
},
"files": [
"schemas"
"schemas",
"fixtures"
],
"scripts": {
"build": "node -e \"console.log('schemas: no build step')\""

View file

@ -0,0 +1,90 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/action.schema.json",
"title": "LogicSRC OpenOntology Action",
"description": "A governed operation that turns a passive knowledge map into an operational layer. Actions reference approved LogicSRC plugin/tool capabilities; ontology packages never embed executable code.",
"type": "object",
"required": ["openontology", "kind", "id", "label", "executor", "permissions", "approval"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Action" },
"id": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"input": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/parameter" }
},
"output": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/parameter" }
},
"preconditions": {
"type": "object",
"additionalProperties": false,
"properties": {
"query": { "type": "string", "description": "Saved query id that must return rows." },
"constraints": { "type": "array", "items": { "type": "string" } }
}
},
"executor": {
"type": "object",
"required": ["type"],
"additionalProperties": false,
"properties": {
"type": { "type": "string", "enum": ["logicsrc-plugin-tool", "mcp-tool", "http"] },
"plugin": { "type": "string" },
"tool": { "type": "string" },
"endpoint": { "type": "string" }
}
},
"permissions": {
"type": "object",
"required": ["required"],
"additionalProperties": false,
"properties": {
"required": {
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true
}
}
},
"approval": {
"type": "object",
"required": ["mode"],
"additionalProperties": false,
"properties": {
"mode": { "type": "string", "enum": ["none", "policy", "always"] },
"approvals": { "type": "integer", "minimum": 0 }
}
},
"sideEffects": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"description": "Declared effects. An undeclared side effect means the action is denied."
},
"idempotencyKey": {
"type": "string",
"description": "Input field used to make retries safe for non-idempotent effects."
},
"events": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
"extensions": { "type": "object" }
},
"$defs": {
"parameter": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "type": "string" },
"entityType": { "type": "string" },
"required": { "type": "boolean", "default": false },
"description": { "type": "string" },
"default": {}
}
}
}
}

View file

@ -0,0 +1,39 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/approval.schema.json",
"title": "LogicSRC OpenOntology Approval",
"description": "A recorded approval that satisfies policy for a change set or governed action. Model confidence never substitutes for an approval.",
"type": "object",
"required": ["openontology", "kind", "id", "changeSet", "approver", "createdAt"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Approval" },
"id": { "type": "string", "minLength": 1 },
"changeSet": { "type": "string", "minLength": 1 },
"approver": { "type": "string", "minLength": 1 },
"approverType": { "type": "string", "enum": ["human", "service", "agent"], "default": "human" },
"scopes": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true,
"description": "Scopes the approver held at approval time."
},
"policy": { "type": "string", "description": "Policy rule id that required this approval." },
"createdAt": { "type": "string", "format": "date-time" },
"comment": { "type": "string" },
"signature": {
"type": "object",
"required": ["algorithm", "signer", "value"],
"additionalProperties": false,
"properties": {
"algorithm": { "type": "string" },
"signer": { "type": "string" },
"value": { "type": "string" },
"created": { "type": "string", "format": "date-time" },
"keyId": { "type": "string" }
}
},
"extensions": { "type": "object" }
}
}

View file

@ -0,0 +1,168 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/changeset.schema.json",
"title": "LogicSRC OpenOntology Change Set",
"description": "An atomic, reviewable proposal to add, correct, merge, dispute, or retract knowledge. Agent-created change sets default to 'proposed'; rollback creates a compensating change set rather than deleting history.",
"type": "object",
"required": ["openontology", "kind", "id", "title", "createdAt", "createdBy", "operations", "status"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "ChangeSet" },
"id": { "type": "string", "minLength": 1 },
"ontology": { "type": "string", "description": "Target package reference, e.g. 'ethereum-ecosystem@0.1.0'." },
"title": { "type": "string", "minLength": 1 },
"rationale": { "type": "string" },
"createdAt": { "type": "string", "format": "date-time" },
"createdBy": { "type": "string", "minLength": 1 },
"actorType": { "type": "string", "enum": ["human", "service", "agent"] },
"runId": { "type": "string", "description": "REQUIRED for agent-created change sets." },
"operations": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/operation" }
},
"requiredApprovals": { "type": "integer", "minimum": 0, "default": 1 },
"status": {
"type": "string",
"enum": ["draft", "proposed", "approved", "applied", "rejected", "conflicted", "withdrawn"]
},
"baseRevision": {
"type": "string",
"description": "Data revision the change set was authored against. Used for optimistic concurrency."
},
"resultRevision": { "type": "string", "description": "Revision produced by applying the change set." },
"validation": { "$ref": "#/$defs/validationSummary" },
"appliedAt": { "type": "string", "format": "date-time" },
"appliedBy": { "type": "string" },
"compensates": { "type": "string", "description": "Change set id this one rolls back." },
"conflictsWith": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
"signatures": {
"type": "array",
"items": {
"type": "object",
"required": ["algorithm", "signer", "value"],
"additionalProperties": false,
"properties": {
"algorithm": { "type": "string" },
"signer": { "type": "string" },
"value": { "type": "string" },
"created": { "type": "string", "format": "date-time" },
"keyId": { "type": "string" }
}
}
},
"extensions": { "type": "object" }
},
"$defs": {
"validationSummary": {
"type": "object",
"additionalProperties": false,
"properties": {
"ok": { "type": "boolean" },
"errors": { "type": "integer", "minimum": 0 },
"warnings": { "type": "integer", "minimum": 0 },
"info": { "type": "integer", "minimum": 0 },
"policy": { "type": "integer", "minimum": 0 },
"validatedAt": { "type": "string", "format": "date-time" }
}
},
"operation": {
"type": "object",
"required": ["op"],
"oneOf": [
{
"additionalProperties": false,
"required": ["op", "value"],
"properties": {
"op": { "const": "add-entity" },
"value": { "type": "object" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "target", "value"],
"properties": {
"op": { "const": "update-metadata" },
"target": { "type": "string" },
"value": { "type": "object" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "value"],
"properties": {
"op": { "const": "assert-claim" },
"value": { "type": "object" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "target"],
"properties": {
"op": { "const": "dispute-claim" },
"target": { "type": "string" },
"reason": { "type": "string" },
"value": { "type": "object" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "target"],
"properties": {
"op": { "const": "retract-claim" },
"target": { "type": "string" },
"reason": { "type": "string" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "target", "value"],
"properties": {
"op": { "const": "supersede-claim" },
"target": { "type": "string" },
"value": { "type": "object" },
"reason": { "type": "string" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "source", "target"],
"properties": {
"op": { "const": "merge-entity" },
"source": { "type": "string", "description": "Entity id being merged away; kept as a redirect." },
"target": { "type": "string", "description": "Surviving entity id." },
"reason": { "type": "string" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "target"],
"properties": {
"op": { "const": "archive-entity" },
"target": { "type": "string" },
"reason": { "type": "string" },
"note": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["op", "value"],
"properties": {
"op": { "const": "schema-migration" },
"value": { "type": "object" },
"breaking": { "type": "boolean", "default": false },
"note": { "type": "string" }
}
}
]
}
}
}

View file

@ -0,0 +1,148 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/claim.schema.json",
"title": "LogicSRC OpenOntology Claim",
"description": "The canonical fact record. A relationship is a claim whose object is an entity reference; a scalar property is a claim whose object is a typed value. Accepted claims are append-only — corrections are expressed as dispute, retraction, or supersession.",
"type": "object",
"required": ["openontology", "kind", "id", "subject", "predicate", "object", "status", "assertedAt", "assertedBy"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Claim" },
"id": { "type": "string", "minLength": 1 },
"ontology": {
"type": "string",
"description": "Package reference the claim belongs to, e.g. 'ethereum-ecosystem@0.1.0'."
},
"subject": { "type": "string", "minLength": 1, "description": "Entity id." },
"predicate": {
"type": "string",
"minLength": 1,
"description": "Relationship type id (entity object) or property id (value object)."
},
"object": { "$ref": "#/$defs/claimObject" },
"status": {
"type": "string",
"enum": ["asserted", "proposed", "disputed", "retracted", "superseded", "derived"]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Metadata about certainty. Confidence is never proof and never grants permission."
},
"validTime": {
"type": "object",
"additionalProperties": false,
"description": "Domain valid time, independent of when the system recorded the claim.",
"properties": {
"from": { "type": ["string", "null"], "format": "date-time" },
"to": { "type": ["string", "null"], "format": "date-time" }
}
},
"observedAt": { "type": "string", "format": "date-time", "description": "Point-in-time observation." },
"assertedAt": { "type": "string", "format": "date-time", "description": "Recorded (system) time." },
"assertedBy": { "type": "string", "minLength": 1, "description": "Actor id — human, service, or agent." },
"runId": {
"type": "string",
"description": "LogicSRC-compatible run record. REQUIRED for agent-created claims."
},
"sources": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"evidence": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"firstParty": {
"type": "boolean",
"description": "Explicit declaration that this is a manual/first-party assertion with no external source."
},
"derivedFrom": {
"type": "object",
"additionalProperties": false,
"description": "REQUIRED for status 'derived': what produced this claim.",
"properties": {
"rule": { "type": "string" },
"query": { "type": "string" },
"transformation": { "type": "string" },
"inputs": { "type": "array", "items": { "type": "string" }, "uniqueItems": true }
}
},
"supersedes": { "type": "string", "description": "Claim id this claim replaces." },
"supersededBy": { "type": "string", "description": "Claim id that replaced this claim." },
"disputes": { "type": "string", "description": "Claim id this claim disputes." },
"retractionReason": { "type": "string" },
"changeSet": { "type": "string", "description": "Change set that introduced this claim." },
"license": { "type": "string" },
"visibility": {
"type": "string",
"enum": ["public", "internal", "private"],
"default": "public"
},
"retention": { "type": "string", "description": "Retention policy identifier." },
"tags": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
"model": { "$ref": "#/$defs/modelProvenance" },
"extensions": { "type": "object" }
},
"$defs": {
"claimObject": {
"description": "Exactly one of an entity reference or a typed scalar value — never both.",
"oneOf": [
{
"type": "object",
"required": ["entity"],
"additionalProperties": false,
"properties": {
"entity": { "type": "string", "minLength": 1 }
}
},
{
"type": "object",
"required": ["value"],
"additionalProperties": false,
"properties": {
"value": {},
"datatype": {
"type": "string",
"enum": [
"string",
"number",
"integer",
"boolean",
"date",
"date-time",
"duration",
"url",
"email",
"enum",
"object",
"array",
"binary-reference"
]
},
"language": { "type": "string", "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$" },
"unit": { "type": "string" }
}
}
]
},
"modelProvenance": {
"type": "object",
"required": ["provider", "model"],
"additionalProperties": false,
"description": "Recorded for AI-extracted proposals. Never stores chain-of-thought.",
"properties": {
"provider": { "type": "string", "minLength": 1 },
"model": { "type": "string", "minLength": 1 },
"modelVersion": { "type": "string" },
"promptVersion": { "type": "string" },
"extractedAt": { "type": "string", "format": "date-time" },
"rationale": { "type": "string", "description": "Concise user-facing rationale only." }
}
}
}
}

View file

@ -0,0 +1,104 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/constraint.schema.json",
"title": "LogicSRC OpenOntology Constraint",
"description": "A deterministic validation rule over the knowledge layer. Constraints never require an LLM to decide conformance.",
"type": "object",
"required": ["openontology", "kind", "id", "description", "rule"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Constraint" },
"id": { "type": "string", "minLength": 1 },
"description": { "type": "string", "minLength": 1 },
"severity": {
"type": "string",
"enum": ["error", "warning", "info", "policy"],
"default": "error"
},
"code": {
"type": "string",
"description": "Stable machine-readable code reported on violation, e.g. 'OO-C-REQUIRED-PREDICATE'."
},
"remediation": { "type": "string", "description": "Hint shown with the violation." },
"rule": { "$ref": "#/$defs/rule" },
"extensions": { "type": "object" }
},
"$defs": {
"rule": {
"type": "object",
"required": ["type"],
"oneOf": [
{
"additionalProperties": false,
"required": ["type", "entityType", "predicate"],
"properties": {
"type": { "const": "required-predicate" },
"entityType": { "type": "string" },
"predicate": { "type": "string" }
}
},
{
"additionalProperties": false,
"required": ["type", "predicate"],
"properties": {
"type": { "const": "cardinality" },
"predicate": { "type": "string" },
"entityType": { "type": "string" },
"min": { "type": "integer", "minimum": 0 },
"max": { "type": "integer", "minimum": 0 }
}
},
{
"additionalProperties": false,
"required": ["type", "predicate"],
"properties": {
"type": { "const": "unique" },
"predicate": { "type": "string" },
"entityType": { "type": "string" },
"scope": { "type": "string", "enum": ["ontology", "entity-type"], "default": "ontology" }
}
},
{
"additionalProperties": false,
"required": ["type", "predicate", "values"],
"properties": {
"type": { "const": "allowed-values" },
"predicate": { "type": "string" },
"values": { "type": "array", "items": {}, "minItems": 1 }
}
},
{
"additionalProperties": false,
"required": ["type", "predicate"],
"properties": {
"type": { "const": "domain-range" },
"predicate": { "type": "string" },
"from": { "type": "array", "items": { "type": "string" } },
"to": { "type": "array", "items": { "type": "string" } }
}
},
{
"additionalProperties": false,
"required": ["type", "predicate"],
"properties": {
"type": { "const": "temporal-bounds" },
"predicate": { "type": "string" },
"notBefore": { "type": "string", "format": "date-time" },
"notAfter": { "type": "string", "format": "date-time" },
"requireValidFrom": { "type": "boolean" }
}
},
{
"additionalProperties": false,
"required": ["type", "query"],
"properties": {
"type": { "const": "query" },
"query": { "type": "string", "description": "Saved query id. Any result row is a violation." },
"expect": { "type": "string", "enum": ["empty", "non-empty"], "default": "empty" }
}
}
]
}
}
}

View file

@ -0,0 +1,107 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/entity-type.schema.json",
"title": "LogicSRC OpenOntology Entity Type",
"description": "An identity-bearing noun of a domain — the kind of thing an entity is.",
"type": "object",
"required": ["openontology", "kind", "id", "label", "description"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "EntityType" },
"id": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"labels": { "$ref": "#/$defs/languageMap" },
"description": { "type": "string", "minLength": 1 },
"descriptions": { "$ref": "#/$defs/languageMap" },
"extends": {
"description": "Parent entity type ids. Inherited properties MUST NOT conflict.",
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"keyProperties": {
"description": "Properties that together identify an entity of this type for resolution and uniqueness checks.",
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"properties": {
"type": "object",
"description": "Property name to inline property definition.",
"additionalProperties": { "$ref": "#/$defs/propertyDefinition" }
},
"deprecated": { "type": "boolean", "default": false },
"deprecationNote": { "type": "string" },
"extensions": { "type": "object" }
},
"$defs": {
"valueType": {
"type": "string",
"enum": [
"string",
"number",
"integer",
"boolean",
"date",
"date-time",
"duration",
"url",
"email",
"enum",
"object",
"array",
"binary-reference",
"entity-reference"
]
},
"propertyDefinition": {
"type": "object",
"required": ["type"],
"additionalProperties": false,
"properties": {
"label": { "type": "string" },
"labels": { "$ref": "#/$defs/languageMap" },
"description": { "type": "string" },
"descriptions": { "$ref": "#/$defs/languageMap" },
"type": { "$ref": "#/$defs/valueType" },
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "$ref": "#/$defs/valueType" },
"entityType": { "type": "string" },
"enum": { "type": "array", "items": {} }
}
},
"entityType": {
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" }, "uniqueItems": true }
]
},
"required": { "type": "boolean", "default": false },
"cardinality": { "type": "string", "enum": ["one", "many"], "default": "one" },
"unique": { "type": "boolean", "default": false },
"default": {},
"examples": { "type": "array", "items": {} },
"enum": { "type": "array", "items": {} },
"pattern": { "type": "string" },
"minimum": { "type": "number" },
"maximum": { "type": "number" },
"minLength": { "type": "integer", "minimum": 0 },
"maxLength": { "type": "integer", "minimum": 0 },
"deprecated": { "type": "boolean", "default": false },
"deprecationNote": { "type": "string" },
"extensions": { "type": "object" }
}
},
"languageMap": {
"type": "object",
"patternProperties": {
"^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$": { "type": "string" }
},
"additionalProperties": false
}
}
}

View file

@ -0,0 +1,59 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/entity.schema.json",
"title": "LogicSRC OpenOntology Entity",
"description": "A specific thing with a stable identity. Entity ids never change when display names or aliases change; deletion is expressed as tombstone/archived/superseded state, never erasure.",
"type": "object",
"required": ["openontology", "kind", "id", "type", "canonicalName", "createdAt", "createdBy"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Entity" },
"id": {
"type": "string",
"minLength": 1,
"description": "Stable id. Package-qualified compact form (prefix:type:slug), an http(s) IRI, or a urn:logicsrc: identifier."
},
"type": { "type": "string", "minLength": 1, "description": "Entity type id." },
"canonicalName": { "type": "string", "minLength": 1 },
"labels": { "$ref": "#/$defs/languageMap" },
"aliases": {
"type": "array",
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"externalIds": {
"type": "object",
"description": "Namespaced external identifiers (github, wikidata, orcid, did, ...). External services are never treated as canonical identity authorities.",
"additionalProperties": { "type": "string" }
},
"status": {
"type": "string",
"enum": ["active", "archived", "tombstone", "superseded", "merged"],
"default": "active"
},
"supersededBy": {
"type": "string",
"description": "Entity id that replaced this one after a merge. Old ids remain resolvable as redirects."
},
"createdAt": { "type": "string", "format": "date-time" },
"createdBy": { "type": "string", "minLength": 1 },
"updatedAt": { "type": "string", "format": "date-time" },
"visibility": {
"type": "string",
"enum": ["public", "internal", "private"],
"default": "public"
},
"tags": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
"extensions": { "type": "object" }
},
"$defs": {
"languageMap": {
"type": "object",
"patternProperties": {
"^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$": { "type": "string" }
},
"additionalProperties": false
}
}
}

View file

@ -0,0 +1,60 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/event.schema.json",
"title": "LogicSRC OpenOntology Event",
"description": "An append-only audit record. Every applied change emits at least one event, attributable to an actor, a policy decision, and a resulting revision.",
"type": "object",
"required": ["openontology", "kind", "id", "type", "at", "actor"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Event" },
"id": { "type": "string", "minLength": 1 },
"type": {
"type": "string",
"enum": [
"package.validated",
"entity.proposed",
"entity.added",
"entity.merged",
"entity.archived",
"claim.proposed",
"claim.asserted",
"claim.disputed",
"claim.retracted",
"claim.superseded",
"changeset.created",
"changeset.reviewed",
"changeset.approved",
"changeset.rejected",
"changeset.applied",
"import.completed",
"export.completed",
"constraint.violated",
"action.executed",
"schema.migrated"
]
},
"ontology": { "type": "string" },
"at": { "type": "string", "format": "date-time" },
"actor": { "type": "string", "minLength": 1 },
"actorType": { "type": "string", "enum": ["human", "service", "agent"] },
"client": { "type": "string" },
"requestId": { "type": "string" },
"runId": { "type": "string" },
"changeSet": { "type": "string" },
"subject": { "type": "string", "description": "Primary object id the event concerns." },
"revision": { "type": "string" },
"policyDecision": {
"type": "object",
"additionalProperties": false,
"properties": {
"rule": { "type": "string" },
"decision": { "type": "string", "enum": ["allow", "deny", "require-approval"] },
"reason": { "type": "string" }
}
},
"data": { "type": "object", "description": "Event-specific payload. Redacted per policy." },
"extensions": { "type": "object" }
}
}

View file

@ -0,0 +1,121 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/evidence.schema.json",
"title": "LogicSRC OpenOntology Evidence",
"description": "A machine-readable pointer into a source that supports a claim. Excerpts are optional and bounded by source licensing, privacy, and configured excerpt limits.",
"type": "object",
"required": ["openontology", "kind", "id", "source", "selector"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Evidence" },
"id": { "type": "string", "minLength": 1 },
"source": { "type": "string", "minLength": 1, "description": "Source id." },
"selector": { "$ref": "#/$defs/selector" },
"excerpt": {
"type": "string",
"description": "Optional short excerpt. Omitted when licensing, privacy, or excerpt limits forbid it."
},
"contentHash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"visibility": {
"type": "string",
"enum": ["public", "internal", "private"],
"default": "public"
},
"extensions": { "type": "object" }
},
"$defs": {
"selector": {
"type": "object",
"required": ["type"],
"description": "One selector shape per source medium.",
"oneOf": [
{
"additionalProperties": false,
"properties": {
"type": { "const": "line-range" },
"start": { "type": "integer", "minimum": 1 },
"end": { "type": "integer", "minimum": 1 },
"path": { "type": "string" }
},
"required": ["type", "start", "end"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "page" },
"page": { "type": "integer", "minimum": 1 }
},
"required": ["type", "page"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "time-range" },
"start": { "type": "number", "minimum": 0 },
"end": { "type": "number", "minimum": 0 }
},
"required": ["type", "start", "end"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "json-pointer" },
"pointer": { "type": "string" }
},
"required": ["type", "pointer"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "xpath" },
"expression": { "type": "string" }
},
"required": ["type", "expression"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "css-selector" },
"expression": { "type": "string" }
},
"required": ["type", "expression"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "database-key" },
"table": { "type": "string" },
"key": { "type": "string" }
},
"required": ["type", "key"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "commit-path" },
"path": { "type": "string" },
"commit": { "type": "string" }
},
"required": ["type", "path"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "api-field" },
"field": { "type": "string" },
"endpoint": { "type": "string" }
},
"required": ["type", "field"]
},
{
"additionalProperties": false,
"properties": {
"type": { "const": "whole-document" }
},
"required": ["type"]
}
]
}
}
}

View file

@ -0,0 +1,148 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/manifest.schema.json",
"title": "LogicSRC OpenOntology Package Manifest",
"description": "The openontology.yaml (or canonical JSON equivalent) that opens every OpenOntology package. Declares identity, namespace, license, maintainers, imports, and the schema/data files that make up the package.",
"type": "object",
"required": [
"openontology",
"kind",
"id",
"name",
"version",
"namespace",
"description",
"license",
"maintainers"
],
"additionalProperties": false,
"properties": {
"openontology": {
"type": "string",
"pattern": "^\\d+\\.\\d+(\\.\\d+)?$",
"description": "OpenOntology standard version this package conforms to, e.g. '0.1'."
},
"kind": { "const": "OntologyPackage" },
"id": {
"type": "string",
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
"description": "Lowercase kebab-case package id, globally disambiguated by namespace when imported."
},
"name": { "type": "string", "minLength": 1 },
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
"description": "Semantic version."
},
"namespace": {
"type": "string",
"format": "uri",
"description": "Base IRI that compact package-qualified ids canonicalize against."
},
"description": { "type": "string", "minLength": 1 },
"license": {
"type": "string",
"minLength": 1,
"description": "SPDX identifier, license URL, or the literal 'unknown'."
},
"maintainers": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/maintainer" }
},
"imports": {
"type": "array",
"items": { "$ref": "#/$defs/import" },
"description": "Other ontology packages imported by immutable version or digest."
},
"schema": {
"type": "object",
"additionalProperties": false,
"description": "Relative paths (or inline arrays) for each schema-layer file.",
"properties": {
"namespaces": { "$ref": "#/$defs/fileOrInline" },
"entityTypes": { "$ref": "#/$defs/fileOrInline" },
"properties": { "$ref": "#/$defs/fileOrInline" },
"relationships": { "$ref": "#/$defs/fileOrInline" },
"constraints": { "$ref": "#/$defs/fileOrInline" },
"queries": { "$ref": "#/$defs/fileOrInline" },
"actions": { "$ref": "#/$defs/fileOrInline" }
}
},
"data": {
"type": "object",
"additionalProperties": false,
"description": "Relative paths (or inline arrays) for each knowledge-layer file.",
"properties": {
"entities": { "$ref": "#/$defs/fileOrInline" },
"claims": { "$ref": "#/$defs/fileOrInline" },
"sources": { "$ref": "#/$defs/fileOrInline" },
"evidence": { "$ref": "#/$defs/fileOrInline" }
}
},
"context": {
"type": "string",
"description": "Relative path to the package's JSON-LD 1.1 context document."
},
"digest": {
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}$",
"description": "Content digest over the canonical manifest and every declared file. Present on published packages."
},
"signatures": {
"type": "array",
"items": { "$ref": "#/$defs/signature" },
"description": "Detached maintainer signatures over the package digest."
},
"extensions": {
"type": "object",
"description": "Namespaced extension point. Keys SHOULD be prefixed to avoid collisions."
}
},
"$defs": {
"maintainer": {
"type": "object",
"required": ["id"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"description": "URI-shaped identity: mailto:, did:, https:, or urn:."
},
"name": { "type": "string" }
}
},
"import": {
"type": "object",
"required": ["id"],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
"version": { "type": "string" },
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"namespace": { "type": "string", "format": "uri" },
"prefix": { "type": "string" }
}
},
"fileOrInline": {
"anyOf": [
{ "type": "string", "minLength": 1 },
{ "type": "array", "items": { "type": "object" } }
]
},
"signature": {
"type": "object",
"required": ["algorithm", "signer", "value"],
"additionalProperties": false,
"description": "Pluggable signature envelope. 'jws-ed25519' is the minimal profile every implementation SHOULD understand.",
"properties": {
"algorithm": { "type": "string", "minLength": 1 },
"signer": { "type": "string", "minLength": 1 },
"value": { "type": "string", "minLength": 1 },
"created": { "type": "string", "format": "date-time" },
"keyId": { "type": "string" }
}
}
}
}

View file

@ -0,0 +1,21 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/namespace.schema.json",
"title": "LogicSRC OpenOntology Namespace",
"description": "A prefix binding used to disambiguate ids and to canonicalize compact package-qualified ids into resolvable IRIs.",
"type": "object",
"required": ["openontology", "kind", "prefix", "uri"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Namespace" },
"prefix": {
"type": "string",
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
"description": "Compact prefix, e.g. 'ethereum' in 'ethereum:person:alice'."
},
"uri": { "type": "string", "format": "uri" },
"description": { "type": "string" },
"extensions": { "type": "object" }
}
}

View file

@ -0,0 +1,73 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/package.schema.json",
"title": "LogicSRC OpenOntology Built Package",
"description": "The deterministic build artifact: the compiled manifest, every schema and knowledge object inlined, a per-file digest table, and the package digest. This is what gets hashed, signed, diffed, and published — never private runtime state or credentials.",
"type": "object",
"required": ["openontology", "kind", "manifest", "digest", "files", "schema", "data"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "BuiltOntologyPackage" },
"manifest": { "type": "object", "description": "The canonical manifest object." },
"digest": {
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}$",
"description": "sha256 over the canonical JSON of the manifest plus the sorted per-file digest table."
},
"builtAt": { "type": "string", "format": "date-time" },
"files": {
"type": "array",
"description": "Per-file digests covering every declared schema and data file.",
"items": {
"type": "object",
"required": ["path", "digest", "count"],
"additionalProperties": false,
"properties": {
"path": { "type": "string" },
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"count": { "type": "integer", "minimum": 0 }
}
}
},
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"namespaces": { "type": "array", "items": { "type": "object" } },
"entityTypes": { "type": "array", "items": { "type": "object" } },
"properties": { "type": "array", "items": { "type": "object" } },
"relationships": { "type": "array", "items": { "type": "object" } },
"constraints": { "type": "array", "items": { "type": "object" } },
"queries": { "type": "array", "items": { "type": "object" } },
"actions": { "type": "array", "items": { "type": "object" } }
}
},
"data": {
"type": "object",
"additionalProperties": false,
"properties": {
"entities": { "type": "array", "items": { "type": "object" } },
"claims": { "type": "array", "items": { "type": "object" } },
"sources": { "type": "array", "items": { "type": "object" } },
"evidence": { "type": "array", "items": { "type": "object" } }
}
},
"context": { "type": "object", "description": "Inlined JSON-LD 1.1 context, when the package declares one." },
"signatures": {
"type": "array",
"items": {
"type": "object",
"required": ["algorithm", "signer", "value"],
"additionalProperties": false,
"properties": {
"algorithm": { "type": "string" },
"signer": { "type": "string" },
"value": { "type": "string" },
"created": { "type": "string", "format": "date-time" },
"keyId": { "type": "string" }
}
}
}
}
}

View file

@ -0,0 +1,83 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/property.schema.json",
"title": "LogicSRC OpenOntology Property Definition",
"description": "A scalar or structured attribute of an entity type. Property values are carried by claims whose object is a typed value.",
"type": "object",
"required": ["openontology", "kind", "id", "label", "type"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Property" },
"id": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"labels": { "$ref": "#/$defs/languageMap" },
"description": { "type": "string" },
"descriptions": { "$ref": "#/$defs/languageMap" },
"type": { "$ref": "#/$defs/valueType" },
"items": {
"description": "Element definition when type is 'array'.",
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "$ref": "#/$defs/valueType" },
"entityType": { "type": "string" },
"enum": { "type": "array", "items": {} }
}
},
"entityType": {
"description": "Allowed entity type when type is 'entity-reference'.",
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" }, "uniqueItems": true }
]
},
"required": { "type": "boolean", "default": false },
"cardinality": {
"type": "string",
"enum": ["one", "many"],
"default": "one"
},
"unique": { "type": "boolean", "default": false },
"default": {},
"examples": { "type": "array", "items": {} },
"enum": { "type": "array", "items": {}, "description": "Allowed values when type is 'enum'." },
"pattern": { "type": "string" },
"minimum": { "type": "number" },
"maximum": { "type": "number" },
"minLength": { "type": "integer", "minimum": 0 },
"maxLength": { "type": "integer", "minimum": 0 },
"deprecated": { "type": "boolean", "default": false },
"deprecationNote": { "type": "string" },
"extensions": { "type": "object" }
},
"$defs": {
"valueType": {
"type": "string",
"enum": [
"string",
"number",
"integer",
"boolean",
"date",
"date-time",
"duration",
"url",
"email",
"enum",
"object",
"array",
"binary-reference",
"entity-reference"
]
},
"languageMap": {
"type": "object",
"description": "BCP-47 language tag to translated text.",
"patternProperties": {
"^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$": { "type": "string" }
},
"additionalProperties": false
}
}
}

View file

@ -0,0 +1,207 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/query.schema.json",
"title": "LogicSRC OpenOntology Query",
"description": "The portable triple-pattern query AST, in either ad-hoc form (openontologyQuery) or saved form (kind: SavedQuery with parameters and an expected result shape). Database-specific languages are adapters over this AST, never a substitute for it.",
"oneOf": [
{ "$ref": "#/$defs/adHocQuery" },
{ "$ref": "#/$defs/savedQuery" }
],
"$defs": {
"adHocQuery": {
"type": "object",
"required": ["openontologyQuery", "match"],
"additionalProperties": false,
"properties": {
"openontologyQuery": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"ontology": { "type": "string" },
"match": { "$ref": "#/$defs/match" },
"where": { "$ref": "#/$defs/where" },
"select": { "$ref": "#/$defs/select" },
"include": { "$ref": "#/$defs/include" },
"orderBy": { "$ref": "#/$defs/orderBy" },
"distinct": { "type": "boolean", "default": false },
"asOf": { "type": "string", "format": "date-time" },
"recordedAsOf": {
"type": "string",
"format": "date-time",
"description": "System-time axis for bitemporal queries."
},
"limit": { "type": "integer", "minimum": 1 },
"offset": { "type": "integer", "minimum": 0 },
"maxDepth": { "type": "integer", "minimum": 1 },
"explain": { "type": "boolean", "default": false }
}
},
"savedQuery": {
"type": "object",
"required": ["openontology", "kind", "id", "description", "query"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "SavedQuery" },
"id": { "type": "string", "minLength": 1 },
"label": { "type": "string" },
"description": { "type": "string", "minLength": 1 },
"version": { "type": "string" },
"parameters": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"properties": {
"type": { "type": "string" },
"required": { "type": "boolean", "default": false },
"default": {},
"description": { "type": "string" }
}
}
},
"expects": {
"type": "object",
"additionalProperties": false,
"description": "Expected result shape, used by tests and UI.",
"properties": {
"columns": { "type": "array", "items": { "type": "string" } },
"minRows": { "type": "integer", "minimum": 0 },
"maxRows": { "type": "integer", "minimum": 0 }
}
},
"query": { "$ref": "#/$defs/queryBody" },
"extensions": { "type": "object" }
}
},
"queryBody": {
"type": "object",
"required": ["match"],
"additionalProperties": false,
"properties": {
"match": { "$ref": "#/$defs/match" },
"where": { "$ref": "#/$defs/where" },
"select": { "$ref": "#/$defs/select" },
"include": { "$ref": "#/$defs/include" },
"orderBy": { "$ref": "#/$defs/orderBy" },
"distinct": { "type": "boolean", "default": false },
"asOf": { "type": "string" },
"recordedAsOf": { "type": "string" },
"limit": { "type": "integer", "minimum": 1 },
"offset": { "type": "integer", "minimum": 0 },
"maxDepth": { "type": "integer", "minimum": 1 }
}
},
"match": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["subject", "predicate", "object"],
"additionalProperties": false,
"description": "A triple pattern. Terms starting with '?' are variables; everything else is a constant.",
"properties": {
"subject": { "type": "string", "minLength": 1 },
"predicate": { "type": "string", "minLength": 1 },
"object": {
"anyOf": [
{ "type": "string", "minLength": 1 },
{
"type": "object",
"additionalProperties": false,
"properties": {
"entity": { "type": "string" },
"value": {},
"variable": { "type": "string" }
}
}
]
},
"optional": { "type": "boolean", "default": false },
"bindClaim": {
"type": "string",
"description": "Variable bound to the matched claim id, for explanations."
}
}
}
},
"where": {
"type": "array",
"items": {
"type": "object",
"required": ["variable", "operator"],
"additionalProperties": false,
"properties": {
"variable": { "type": "string", "minLength": 1 },
"field": {
"type": "string",
"description": "Entity field or property predicate to compare. Defaults to the bound term itself."
},
"operator": {
"type": "string",
"enum": [
"eq",
"neq",
"lt",
"lte",
"gt",
"gte",
"in",
"not-in",
"exists",
"not-exists",
"contains",
"starts-with",
"matches",
"before",
"after"
]
},
"value": {}
}
}
},
"select": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "minLength": 1 }
},
"include": {
"type": "object",
"additionalProperties": false,
"description": "Claim-status inclusion policy. Each status is filterable independently.",
"properties": {
"claimStatus": {
"type": "array",
"items": {
"type": "string",
"enum": ["asserted", "proposed", "disputed", "retracted", "superseded", "derived"]
},
"uniqueItems": true
},
"derived": { "type": "boolean" },
"labels": { "type": "boolean", "description": "Expand entity labels in results." },
"properties": {
"type": "array",
"items": { "type": "string" },
"description": "Additional entity properties to expand in results."
},
"visibility": {
"type": "array",
"items": { "type": "string", "enum": ["public", "internal", "private"] },
"uniqueItems": true
}
}
},
"orderBy": {
"type": "array",
"items": {
"type": "object",
"required": ["variable"],
"additionalProperties": false,
"properties": {
"variable": { "type": "string" },
"field": { "type": "string" },
"direction": { "type": "string", "enum": ["asc", "desc"], "default": "asc" }
}
}
}
}
}

View file

@ -0,0 +1,57 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/relationship-type.schema.json",
"title": "LogicSRC OpenOntology Relationship Type",
"description": "A typed connection whose object is another entity. Symmetry, transitivity, and inverses are never inferred unless declared here and explicitly permitted by a query.",
"type": "object",
"required": ["openontology", "kind", "id", "label", "description", "from", "to"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "RelationshipType" },
"id": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"labels": { "$ref": "#/$defs/languageMap" },
"description": { "type": "string", "minLength": 1 },
"descriptions": { "$ref": "#/$defs/languageMap" },
"from": {
"description": "Allowed subject entity types (domain).",
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true
},
"to": {
"description": "Allowed object entity types (range).",
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true
},
"cardinality": {
"type": "string",
"enum": ["one-to-one", "one-to-many", "many-to-one", "many-to-many"],
"default": "many-to-many"
},
"temporal": {
"type": "boolean",
"default": false,
"description": "Whether claims using this predicate are expected to carry valid time."
},
"inverse": { "type": "string", "description": "Relationship type id of the declared inverse." },
"symmetric": { "type": "boolean", "default": false },
"transitive": { "type": "boolean", "default": false },
"deprecated": { "type": "boolean", "default": false },
"deprecationNote": { "type": "string" },
"extensions": { "type": "object" }
},
"$defs": {
"languageMap": {
"type": "object",
"patternProperties": {
"^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$": { "type": "string" }
},
"additionalProperties": false
}
}
}

View file

@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/review.schema.json",
"title": "LogicSRC OpenOntology Review",
"description": "A reviewer's assessment of a change set. Rejected change sets remain inspectable together with their reviews.",
"type": "object",
"required": ["openontology", "kind", "id", "changeSet", "reviewer", "state", "createdAt"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Review" },
"id": { "type": "string", "minLength": 1 },
"changeSet": { "type": "string", "minLength": 1 },
"reviewer": { "type": "string", "minLength": 1 },
"state": {
"type": "string",
"enum": ["commented", "changes-requested", "approved", "rejected"]
},
"comment": { "type": "string" },
"createdAt": { "type": "string", "format": "date-time" },
"operationDecisions": {
"type": "array",
"description": "Per-operation accept/reject, so a curator can take part of an AI-generated change set.",
"items": {
"type": "object",
"required": ["index", "decision"],
"additionalProperties": false,
"properties": {
"index": { "type": "integer", "minimum": 0 },
"decision": { "type": "string", "enum": ["accept", "reject"] },
"comment": { "type": "string" }
}
}
},
"extensions": { "type": "object" }
}
}

View file

@ -0,0 +1,43 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://logicsrc.com/schemas/openontology/source.schema.json",
"title": "LogicSRC OpenOntology Source",
"description": "Where a claim came from. Content hashes let implementations detect changed or unavailable source material.",
"type": "object",
"required": ["openontology", "kind", "id", "sourceType", "uri", "retrievedAt"],
"additionalProperties": false,
"properties": {
"openontology": { "type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$" },
"kind": { "const": "Source" },
"id": { "type": "string", "minLength": 1 },
"sourceType": {
"type": "string",
"minLength": 1,
"description": "e.g. git-commit, web-page, api-response, csv, markdown, database-row, manual."
},
"uri": { "type": "string", "minLength": 1 },
"title": { "type": "string" },
"publisher": { "type": "string" },
"author": { "type": "string" },
"retrievedAt": { "type": "string", "format": "date-time" },
"publishedAt": { "type": "string", "format": "date-time" },
"contentHash": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"mediaType": { "type": "string" },
"license": {
"type": "string",
"description": "SPDX id, license URL, or 'unknown'. Governs whether excerpts may be redistributed."
},
"visibility": {
"type": "string",
"enum": ["public", "internal", "private"],
"default": "public"
},
"stale": {
"type": "boolean",
"description": "Set when a re-fetch found different content or the source became unavailable."
},
"lastCheckedAt": { "type": "string", "format": "date-time" },
"adapter": { "type": "string", "description": "Source adapter that produced this record." },
"extensions": { "type": "object" }
}
}