Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Database Ontology View

The ontology view describes what is in one database: its concepts (node labels), the exact label combinations nodes carry, the directed relationship shapes between those combinations, the properties observed on each label and relationship type with their value types, and the constraints and indexes that are actually declared. It is a read-only projection of the current committed state (RFC 0039).

The view is descriptive. An observation never becomes a rule:

  • 100 % observed coverage of a property is shown as present on all observed members, never as required. A later write without that property is still valid unless an actual constraint says otherwise.
  • Labels that occur together (:Supplier:Preferred) are reported as one label combination. No subclass relation is inferred.
  • Observed value types are not a type declaration, and observed endpoints are not a domain/range declaration.
  • Only real catalog definitions appear as declared rules. When observed data contradicts a declaration (for example a missing value under an existence constraint), both are shown together with the discrepancy; the data is not changed.

Enabling discovery

Exact discovery reads the whole graph, so it is off by default on a server and in the console’s file mode:

PATINADB_ONTOLOGY_DISCOVERY=on patinadb-raft …

Without it, the procedure fails with patinadb.ontology is disabled on this server. The Rust embedded API Dataset::ontology_view is not affected by this switch.

Querying it

CALL patinadb.ontology() YIELD view RETURN view
CALL patinadb.ontology({mode: 'exact', maxRecords: 10000, maxResultBytes: 4194304})
YIELD view RETURN view

The procedure yields one row whose view column is a structured map (a JSON-LD document), not JSON text. It works over embedded Dataset::query, REST /cypher and Bolt, and every transport returns the same document. The database comes from normal routing (USE <db> or the session database).

Options (all optional): mode must be 'exact'; maxRecords and maxResultBytes may only lower the server limits below. Any other key, or a larger value than the server limit, is an argument error raised before any data is read.

The call must be a standalone read of the current state. These are refused with an explicit error instead of returning something weaker:

  • a call per input row (UNWIND … CALL patinadb.ontology()), inside a subquery, or in a writing statement;
  • inside an explicit transaction;
  • any AS OF call, including AS OF the current HEAD (historical ontology views are a later increment).

Authorization

The view covers the whole database, so it requires unrestricted read access to it (the ordinary Reader role is enough). A principal holding any label-, relationship-type- or relationship-property-scoped grant on that database is refused (Neo.ClientError.Security.Forbidden), even if the relationship strict modes are off. The result is never filtered to an empty or partial ontology, and a refusal carries no label names or counts.

Limits

SettingDefaultMeaning
PATINADB_ONTOLOGY_MAX_RECORDS50 000Records in one view (concepts, label combinations, relationship types and shapes, property terms and observations, declarations).
PATINADB_ONTOLOGY_MAX_RESULT_BYTES32 MiBEncoded size (compact JSON) of one view.
PATINADB_ONTOLOGY_MAX_WORKING_BYTES256 MiBAccounted working state while collecting.

All three are read once at startup. Exceeding one fails the call with ResourceExhausted; no partial view is returned. Accounting is an estimate, not a hard process-memory limit. Collection time grows with the number of nodes and relationships (every node, property and relationship is read); the size of the result grows with the number of distinct label combinations and property names. Measured examples are in the RFC (tag RFC0039).

Deadlines (--query-timeout) and cancellation stop collection; read faults fail the call.

The JSON-LD document

The document carries an inline @context (no network access needed), an absolute @id naming this view, and an @graph. Its first record is the patina:OntologyView with:

FieldMeaning
format_version1.
databaseRegistry name, incarnation (or identity_status: unassigned).
snapshotscope: head, the HEAD Engram read in the same snapshot, read_state: local_applied_state (a follower reports its own applied state).
coveragemode: exact, observations: complete, scope: whole_database, per-collection status; values_included: false, uniqueness_validated: false.
catalogstatus: available_at_snapshot, a fingerprint of the declarations, the catalog families read, and the excluded legacy family.
concepts, node_shapes, relationship_types, relationship_shapes, properties, constraints, indexes, discrepanciesLinks to the records in the same graph.

Concepts are rdfs:Class, relationship types and scoped properties are rdf:Property; everything else uses the versioned Patina vocabulary (urn:patinadb:ontology:v1:, never dereferenced). Property observations carry population_count, present_count, missing_count and observed_types (one count per type: Integer, Float, String, Uuid, Boolean, LegacyTimestamp, Date, LocalTime, Time, LocalDateTime, DateTime, Duration, Point, Polygon, List, Map, Path). Node property statistics cover every node carrying the label (primary or secondary); relationship property statistics are type-wide. A stored null counts as missing. Counts above 2^53−1 are written as exact xsd:integer literals. Record IRIs are stable for the same database incarnation and names; they are not node or relationship ids. No property values are included.

Control Panel

The console’s Ontology screen (#/ontology, in the Query section, all connection modes) loads the view only when you press Load ontology — it never scans on navigation. The screen shows the database, snapshot, mode and catalog status; a searchable list of concepts and relationship types; a type-level graph whose vertices are label combinations and whose arrows are relationship shapes with counts; and a detail panel separating observed properties from declared rules. Filtering only changes what is displayed; Download JSON-LD always saves the complete received document. Permission, disabled, unsupported-server and limit failures are shown as such, never as an empty ontology; a failed refresh keeps the previous result, labelled as previous. Each console instance serves one database, so switching databases means opening that database’s console; responses for a previous session or database are discarded.

Not included yet

Historical views and comparison, sampled discovery, SHACL export, MCP access and scoped (filtered) ontologies are not available. See Limitations.