@kanonak-protocol/types 4.13.0 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -67,14 +67,6 @@ export interface ResourceResolver {
|
|
|
67
67
|
* Clears cache for a specific document.
|
|
68
68
|
*/
|
|
69
69
|
clearCache(documentKey: string): void;
|
|
70
|
-
/**
|
|
71
|
-
* Checks if a class is a subclass of another class (direct or transitive)
|
|
72
|
-
*/
|
|
73
|
-
isSubclassOfAsync(className: string, parentClassName: string, document: KanonakDocument): Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* Checks if a property is a subproperty of another property (direct or transitive)
|
|
76
|
-
*/
|
|
77
|
-
isSubpropertyOfAsync(propertyName: string, parentPropertyName: string, document: KanonakDocument): Promise<boolean>;
|
|
78
70
|
}
|
|
79
71
|
/**
|
|
80
72
|
* Classifies Kanonak resources by their semantic type (Class, Property, Instance, etc.). This is the canonical source of truth for resource type classification. Uses resolved KanonakUri, NOT document-scoped aliases.
|
|
@@ -9,5 +9,10 @@ export declare enum ValidationSeverity {
|
|
|
9
9
|
/**
|
|
10
10
|
* Critical issue that must be fixed
|
|
11
11
|
*/
|
|
12
|
-
Error = 1
|
|
12
|
+
Error = 1,
|
|
13
|
+
/**
|
|
14
|
+
* Informational notice — resolution succeeds, but something is worth
|
|
15
|
+
* confirming (e.g. a local entity shadowing a reserved built-in name).
|
|
16
|
+
*/
|
|
17
|
+
Info = 2
|
|
13
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var g=(f=>(f[f.Warning=0]="Warning",f[f.Error=1]="Error",f[f.Info=2]="Info",f))(g||{});export{g as ValidationSeverity};
|
|
@@ -3,6 +3,27 @@ import { KanonakDocument } from '../../../../document/models/types';
|
|
|
3
3
|
import { KanonakUri } from '../../../../object/uris/types';
|
|
4
4
|
import { IRepositoryValidationRule } from '../../../../object/validation/rules/repository/index';
|
|
5
5
|
import { OntologyValidationError } from '../../../../object/validation/types';
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a property's declared kind matches the nature of its range: a
|
|
8
|
+
* DatatypeProperty must range over a datatype (xsd type, rdfs.Literal, or a
|
|
9
|
+
* datatype-derived class), an ObjectProperty over a plain class. The nature is
|
|
10
|
+
* decided by walking the range's subClassOf chain (a datatype-derived class is
|
|
11
|
+
* datatype-valued even though rdfs.Datatype is a kind of rdfs.Class).
|
|
12
|
+
*/
|
|
13
|
+
export interface PropertyKindRangeConsistencyRule extends IRepositoryValidationRule {
|
|
14
|
+
readonly ruleName: string;
|
|
15
|
+
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* INFO: a package defines a local entity whose name is a reserved built-in term
|
|
19
|
+
* homed in a different package (e.g. core-owl/Class shadows the built-in
|
|
20
|
+
* rdfs.Class). Usually intentional, but surfaced so a bare reference silently
|
|
21
|
+
* resolving to the local definition can't hide a mistake.
|
|
22
|
+
*/
|
|
23
|
+
export interface ReservedNameShadowRule extends IRepositoryValidationRule {
|
|
24
|
+
readonly ruleName: string;
|
|
25
|
+
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
26
|
+
}
|
|
6
27
|
/**
|
|
7
28
|
* Validates that references to entities or properties are unambiguous. When multiple imports define the same entity/property name, namespace aliases MUST be used to disambiguate (e.g., 'people.name' vs 'heroes.name'). When only one source defines an entity, aliases are optional. Design Philosophy: - Aliases are document-scoped only (not transitive) - Aliases are required ONLY when ambiguity exists - Aliases are optional when references are unambiguous
|
|
8
29
|
*/
|
|
@@ -24,13 +45,6 @@ export interface ClassHierarchyCycleRule extends IRepositoryValidationRule {
|
|
|
24
45
|
readonly ruleName: string;
|
|
25
46
|
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
26
47
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Validates that properties used on Class and Property definitions are actually defined. When a class or property definition uses a property (e.g., "icon: ✅"), this rule ensures that the property "icon" is defined as an ObjectProperty or DatatypeProperty either locally or in imported namespaces.
|
|
29
|
-
*/
|
|
30
|
-
export interface DefinitionPropertyReferenceRule extends IRepositoryValidationRule {
|
|
31
|
-
readonly ruleName: string;
|
|
32
|
-
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
33
|
-
}
|
|
34
48
|
export interface ImportErrorDetails {
|
|
35
49
|
message: string;
|
|
36
50
|
suggestion: string;
|
|
@@ -57,13 +71,6 @@ export interface NamespaceImportCycleRule extends IRepositoryValidationRule {
|
|
|
57
71
|
readonly ruleName: string;
|
|
58
72
|
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
59
73
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Validates that namespaces for ObjectProperty range classes are imported
|
|
62
|
-
*/
|
|
63
|
-
export interface ObjectPropertyImportRule extends IRepositoryValidationRule {
|
|
64
|
-
readonly ruleName: string;
|
|
65
|
-
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
66
|
-
}
|
|
67
74
|
/**
|
|
68
75
|
* Validates that ALL ObjectProperty values point to existing entities. Uses TypeResolver to determine which properties are ObjectProperties (explicit or inferred from range).
|
|
69
76
|
*/
|
|
@@ -104,13 +111,6 @@ export interface PropertyRangeRequiredRule extends IRepositoryValidationRule {
|
|
|
104
111
|
readonly ruleName: string;
|
|
105
112
|
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
106
113
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Validates that instance property values match their declared property types and ranges. Prevents setting complex objects on DatatypeProperties and ensures ObjectProperty values are valid.
|
|
109
|
-
*/
|
|
110
|
-
export interface PropertyValueTypeRule extends IRepositoryValidationRule {
|
|
111
|
-
readonly ruleName: string;
|
|
112
|
-
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
113
|
-
}
|
|
114
114
|
/**
|
|
115
115
|
* Validates that subClassOf references point to existing classes
|
|
116
116
|
*/
|
|
@@ -139,10 +139,3 @@ export interface UnresolvedReferenceRule extends IRepositoryValidationRule {
|
|
|
139
139
|
readonly ruleName: string;
|
|
140
140
|
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Validates that XSD namespace is imported when DatatypeProperty uses XSD types
|
|
144
|
-
*/
|
|
145
|
-
export interface XsdImportRule extends IRepositoryValidationRule {
|
|
146
|
-
readonly ruleName: string;
|
|
147
|
-
validateAsync(document: KanonakDocument, repository: IKanonakDocumentRepository): Promise<Array<OntologyValidationError>>;
|
|
148
|
-
}
|
|
@@ -99,9 +99,17 @@ export interface OntologyValidationResult {
|
|
|
99
99
|
*/
|
|
100
100
|
warnings: Array<OntologyValidationError>;
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* List of informational notices (never affect `isValid`)
|
|
103
|
+
*/
|
|
104
|
+
infos: Array<OntologyValidationError>;
|
|
105
|
+
/**
|
|
106
|
+
* Total count of issues (errors + warnings + infos)
|
|
103
107
|
*/
|
|
104
108
|
readonly totalIssues: number;
|
|
109
|
+
/**
|
|
110
|
+
* All diagnostics across every severity, errors first.
|
|
111
|
+
*/
|
|
112
|
+
readonly allDiagnostics: Array<OntologyValidationError>;
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
107
115
|
* Context for validation operations, carrying metadata needed for type inference and validation
|