TypeQLiteValidator
Defined in: libs/language/src/typeqlite-validator.ts:148
TypeQLite’s validation checks, as methods. registerValidationChecks registers them with the services’
validation registry; the runtime runs them synchronously through validateSync.
Member summary
Section titled “Member summary”Constructors
| Name | Description |
|---|---|
| new TypeQLiteValidator() | Creates a TypeQLiteValidator. |
Methods
| Name | Description |
|---|---|
| checkAnnotationNotEnforced() | An annotation the runtime does not enforce — reported on every parse, never refused. |
| checkAnnotationsOnDefinition() | Every annotation on a definition sits on a subject that admits it — ADMITTED in typeqlite-annotations.ts — and the definition’s value, if any, is a value type and belongs on an attribute. |
| checkAnnotationsOnRedefine() | The same table on a redefine: its one change is a type-level annotation, a value type’s, or a trait (whose own check runs on the trait node). |
| checkAnnotationsOnTrait() | Checks the annotations on an owns, relates or plays trait against the ones that subject admits. |
| checkLabelsAreUnique() | TypeDB labels are unique across all types, not per kind. |
| checkNoDuplicateOwns() | Owning the same attribute twice is idempotent when the two say the same thing — owns price, owns price — and refused when they disagree, on @key or any annotation, or one is ordered: which would win is not the writer’s to guess. |
| checkReservedKeywords() | Reserved keywords parse here and fail only against a real TypeDB. |
| checkValueVariablesBound() | Every variable a let or a comparison reads is bound somewhere in the match — by a concept pattern or another let. |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TypeQLiteValidator():
TypeQLiteValidator
Returns
Section titled “Returns”TypeQLiteValidator
Methods
Section titled “Methods”checkAnnotationNotEnforced()
Section titled “checkAnnotationNotEnforced()”checkAnnotationNotEnforced(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:156
An annotation the runtime does not enforce — reported on every parse, never refused.
One rule, one message shape, for every kind: the annotation’s name comes from the node’s own keyword, so adding an annotation to the grammar and registering it above is the whole cost of reporting it.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
checkAnnotationsOnDefinition()
Section titled “checkAnnotationsOnDefinition()”checkAnnotationsOnDefinition(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:179
Every annotation on a definition sits on a subject that admits it — ADMITTED in
typeqlite-annotations.ts — and the definition’s value, if any, is a value type and belongs on
an attribute. The AST carries three lists per definition because an annotation belongs to the
thing it follows: entity player sub person @abstract puts @abstract on the sub, where
TypeDB refuses it, and only a split list can say so.
Parameters
Section titled “Parameters”AttributeDef | EntityDef | RelationDef | TypeExtensionDef
accept
Section titled “accept”Returns
Section titled “Returns”void
checkAnnotationsOnRedefine()
Section titled “checkAnnotationsOnRedefine()”checkAnnotationsOnRedefine(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:239
The same table on a redefine: its one change is a type-level annotation, a value type’s, or
a trait (whose own check runs on the trait node). The subject is the kind keyword’s, or
type when the redefine names the type bare.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
checkAnnotationsOnTrait()
Section titled “checkAnnotationsOnTrait()”checkAnnotationsOnTrait(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:270
Checks the annotations on an owns, relates or plays trait against the ones that subject admits. A list
(owns name[], relates parent[]) admits @distinct besides.
Parameters
Section titled “Parameters”OwnsTrait | PlaysTrait | RelatesTrait
accept
Section titled “accept”Returns
Section titled “Returns”void
checkLabelsAreUnique()
Section titled “checkLabelsAreUnique()”checkLabelsAreUnique(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:380
TypeDB labels are unique across all types, not per kind. Recorded the hard way in
tracker.schema.typeqlite: a relation named task beside the entity of that name fails
with [SVL2] Label 'task' should be unique, but is already used by 'entity', which is
why the relation is called project-task.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
checkNoDuplicateOwns()
Section titled “checkNoDuplicateOwns()”checkNoDuplicateOwns(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:418
Owning the same attribute twice is idempotent when the two say the same thing — owns price, owns price — and refused when they disagree, on @key or
any annotation, or one is ordered: which would win is not the writer’s to guess.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
checkReservedKeywords()
Section titled “checkReservedKeywords()”checkReservedKeywords(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:401
Reserved keywords parse here and fail only against a real TypeDB.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
checkValueVariablesBound()
Section titled “checkValueVariablesBound()”checkValueVariablesBound(
node,accept):void
Defined in: libs/language/src/typeqlite-validator.ts:466
Every variable a let or a comparison reads is bound somewhere in the match — by a concept
pattern or another let. $v == $a; $v > $h; with no let $v is TypeDB’s “The variable ‘v’
must be bound to a value before it’s used”, and it is a compile-time
refusal there, so it is one here — not a zero-row answer from the engine.
Parameters
Section titled “Parameters”accept
Section titled “accept”Returns
Section titled “Returns”void
TypeDBLite is an independent open-source project, built on TypeDB with thanks. It is not affiliated with, sponsored by, or endorsed by TypeDB Ltd. Released under the MPL-2.0 license.