@intellectual-frontiers/ergonex 0.2.5 → 0.3.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.
Files changed (93) hide show
  1. package/README.md +2 -0
  2. package/dist/desired.d.ts +27 -0
  3. package/dist/diff.d.ts +12 -0
  4. package/dist/doctor.d.ts +79 -0
  5. package/dist/findings.d.ts +85 -0
  6. package/dist/layout.d.ts +83 -0
  7. package/dist/manifest.d.ts +84 -0
  8. package/dist/mod.d.ts +29 -0
  9. package/dist/mod.js +4219 -0
  10. package/dist/modules/external.d.ts +31 -0
  11. package/dist/modules/mod.d.ts +10 -0
  12. package/dist/modules/name.d.ts +32 -0
  13. package/dist/modules/registry.d.ts +51 -0
  14. package/dist/modules/types.d.ts +178 -0
  15. package/dist/places.d.ts +35 -0
  16. package/dist/plan.d.ts +176 -0
  17. package/dist/platform/k-args.d.ts +28 -0
  18. package/dist/policy.d.ts +39 -0
  19. package/dist/portable.d.ts +111 -0
  20. package/dist/render.d.ts +95 -0
  21. package/dist/setup/evidence.d.ts +58 -0
  22. package/dist/shell/block.d.ts +45 -0
  23. package/dist/shell/mod.d.ts +8 -0
  24. package/dist/shell/snippet.d.ts +43 -0
  25. package/dist/state-record.d.ts +59 -0
  26. package/dist/state.d.ts +64 -0
  27. package/dist/templates/data.d.ts +25 -0
  28. package/dist/templates/hooks.d.ts +13 -0
  29. package/dist/templates/mod.d.ts +16 -0
  30. package/dist/tools/catalog.d.ts +70 -0
  31. package/dist/types.d.ts +51 -0
  32. package/dist/vendor/ts/githost/capabilities.d.ts +18 -0
  33. package/dist/vendor/ts/githost/git.d.ts +16 -0
  34. package/dist/vendor/ts/githost/github.d.ts +15 -0
  35. package/dist/vendor/ts/githost/gitlab.d.ts +15 -0
  36. package/dist/vendor/ts/githost/mod.d.ts +29 -0
  37. package/dist/vendor/ts/githost/remote.d.ts +59 -0
  38. package/dist/vendor/ts/githost/types.d.ts +101 -0
  39. package/dist/vendor/ts/kernel/archive.d.ts +147 -0
  40. package/dist/vendor/ts/kernel/args.d.ts +240 -0
  41. package/dist/vendor/ts/kernel/assess.d.ts +247 -0
  42. package/dist/vendor/ts/kernel/attest.d.ts +164 -0
  43. package/dist/vendor/ts/kernel/base64.d.ts +24 -0
  44. package/dist/vendor/ts/kernel/cbor.d.ts +39 -0
  45. package/dist/vendor/ts/kernel/cms.d.ts +106 -0
  46. package/dist/vendor/ts/kernel/commands.d.ts +103 -0
  47. package/dist/vendor/ts/kernel/cose.d.ts +34 -0
  48. package/dist/vendor/ts/kernel/crypt.d.ts +30 -0
  49. package/dist/vendor/ts/kernel/csv.d.ts +38 -0
  50. package/dist/vendor/ts/kernel/der.d.ts +67 -0
  51. package/dist/vendor/ts/kernel/documentation.d.ts +118 -0
  52. package/dist/vendor/ts/kernel/dsse.d.ts +137 -0
  53. package/dist/vendor/ts/kernel/evidence.d.ts +212 -0
  54. package/dist/vendor/ts/kernel/glob.d.ts +64 -0
  55. package/dist/vendor/ts/kernel/grc.d.ts +356 -0
  56. package/dist/vendor/ts/kernel/http.d.ts +46 -0
  57. package/dist/vendor/ts/kernel/json5.d.ts +46 -0
  58. package/dist/vendor/ts/kernel/layers.d.ts +35 -0
  59. package/dist/vendor/ts/kernel/md5.d.ts +19 -0
  60. package/dist/vendor/ts/kernel/media-types.d.ts +28 -0
  61. package/dist/vendor/ts/kernel/mod.d.ts +95 -0
  62. package/dist/vendor/ts/kernel/ocsf-types.auto.d.ts +4374 -0
  63. package/dist/vendor/ts/kernel/ocsf.d.ts +160 -0
  64. package/dist/vendor/ts/kernel/oscal.d.ts +356 -0
  65. package/dist/vendor/ts/kernel/otel.d.ts +365 -0
  66. package/dist/vendor/ts/kernel/otlp.d.ts +83 -0
  67. package/dist/vendor/ts/kernel/palette.d.ts +44 -0
  68. package/dist/vendor/ts/kernel/png.d.ts +124 -0
  69. package/dist/vendor/ts/kernel/rdf-schema.d.ts +190 -0
  70. package/dist/vendor/ts/kernel/rdf-term.d.ts +162 -0
  71. package/dist/vendor/ts/kernel/rdf-vocabularies.d.ts +148 -0
  72. package/dist/vendor/ts/kernel/rdf-write.d.ts +25 -0
  73. package/dist/vendor/ts/kernel/rdf.d.ts +35 -0
  74. package/dist/vendor/ts/kernel/render.d.ts +111 -0
  75. package/dist/vendor/ts/kernel/schedule.d.ts +207 -0
  76. package/dist/vendor/ts/kernel/semver.d.ts +94 -0
  77. package/dist/vendor/ts/kernel/sha256.d.ts +29 -0
  78. package/dist/vendor/ts/kernel/signals.d.ts +371 -0
  79. package/dist/vendor/ts/kernel/sigv4.d.ts +67 -0
  80. package/dist/vendor/ts/kernel/test-record.d.ts +222 -0
  81. package/dist/vendor/ts/kernel/test-report.d.ts +294 -0
  82. package/dist/vendor/ts/kernel/toml.d.ts +51 -0
  83. package/dist/vendor/ts/kernel/trace.d.ts +169 -0
  84. package/dist/vendor/ts/kernel/ts-literal.d.ts +62 -0
  85. package/dist/vendor/ts/kernel/uuid.d.ts +53 -0
  86. package/dist/vendor/ts/kernel/vt.d.ts +78 -0
  87. package/dist/vendor/ts/kernel/webauthn.d.ts +212 -0
  88. package/dist/vendor/ts/kernel/width.d.ts +63 -0
  89. package/dist/vendor/ts/kernel/xml.d.ts +73 -0
  90. package/dist/vendor/ts/kernel/yaml.d.ts +44 -0
  91. package/dist/vendor/ts/runtime/http-client.d.ts +149 -0
  92. package/ergonex.mjs +140 -140
  93. package/package.json +17 -5
@@ -0,0 +1,190 @@
1
+ import { type Iri, type LangString, type Named, type NamedOf, type Namespace, type Triple, type Value, type VocabularyTerm } from "./rdf-term.js";
2
+ /** What a field's values may be: a plain string, a string in a language, either, a boolean, an integer, or a reference. */
3
+ export type RangeKind = "string" | "lang" | "text" | "boolean" | "integer" | "ref";
4
+ /** A field's range, with the TypeScript type `V` of its values for the compiler. */
5
+ export type Range<V> = {
6
+ readonly kind: RangeKind;
7
+ readonly words?: readonly string[];
8
+ readonly "@ifc/rdf-value": V;
9
+ };
10
+ /** The ranges of a field. `ref<"a" | "b">()` accepts an individual of either class. */
11
+ export declare const range: {
12
+ /** A plain string (`xsd:string`). */
13
+ readonly string: Range<string>;
14
+ /** A string in a language. */
15
+ readonly langString: Range<LangString>;
16
+ /** A plain string or a string in a language. */
17
+ readonly text: Range<string | LangString>;
18
+ /** A boolean (`xsd:boolean`). */
19
+ readonly boolean: Range<boolean>;
20
+ /** An integer (`xsd:integer`); one that is not a safe integer is found by `validate`. */
21
+ readonly integer: Range<number>;
22
+ /** A reference to an individual of one of the classes `C`. */
23
+ readonly ref: <C extends string>() => Range<NamedOf<C>>;
24
+ /** A plain string that is one of `words`: the union of the words is the field's type. */
25
+ readonly oneOf: <const W extends readonly [string, ...string[]]>(words: W) => Range<W[number]>;
26
+ };
27
+ /** How many values a field holds: exactly one, at most one, or any number in order. */
28
+ export type Cardinality = "one" | "optional" | "many";
29
+ /** A field of a schema: its property, its range and its cardinality. */
30
+ export type Field<V, K extends Cardinality> = {
31
+ readonly property: Named;
32
+ readonly range: Range<V>;
33
+ readonly cardinality: K;
34
+ };
35
+ /** A field holding exactly one value. */
36
+ export declare function one<V>(property: Named, r: Range<V>): Field<V, "one">;
37
+ /** A field holding at most one value. */
38
+ export declare function optional<V>(property: Named, r: Range<V>): Field<V, "optional">;
39
+ /** A field holding any number of values, in the order given. */
40
+ export declare function many<V>(property: Named, r: Range<V>): Field<V, "many">;
41
+ /** The fields of a schema, by the names its individuals' values are written with. */
42
+ export type Fields = Readonly<Record<string, Field<unknown, Cardinality>>>;
43
+ type ValueOf<F> = F extends Field<infer V, Cardinality> ? V : never;
44
+ type Keys<S extends Fields, K extends Cardinality> = {
45
+ readonly [N in keyof S]: S[N] extends Field<unknown, K> ? N : never;
46
+ }[keyof S];
47
+ /** The values of an individual of a schema with the fields `S`: a required field's value, an optional one's, a list for `many`. */
48
+ export type ValuesOf<S extends Fields> = {
49
+ readonly [N in Keys<S, "one">]: ValueOf<S[N]>;
50
+ } & {
51
+ readonly [N in Keys<S, "optional">]?: ValueOf<S[N]>;
52
+ } & {
53
+ readonly [N in Keys<S, "many">]?: readonly ValueOf<S[N]>[];
54
+ };
55
+ /** One predicate of an individual and its values in order: what its triples are made from. */
56
+ export type Statement = {
57
+ readonly predicate: Named;
58
+ readonly objects: readonly Value[];
59
+ readonly words?: readonly string[];
60
+ };
61
+ /** An individual: a named node of its class `C`, with the class, its values `V` and the statements they make (its type first). */
62
+ export type Individual<C extends string, V> = Named<C> & {
63
+ readonly class: Named;
64
+ readonly values: V;
65
+ readonly statements: readonly Statement[];
66
+ };
67
+ /** An individual of any class, as a writer or a check takes it. */
68
+ export type AnyIndividual = Named & {
69
+ readonly class: Named;
70
+ readonly statements: readonly Statement[];
71
+ };
72
+ /** A class schema: the class, its CURIE, its fields, and how an individual of it is made. */
73
+ export type ClassSchema<C extends string, S extends Fields> = {
74
+ /** The class. */
75
+ readonly class: Named;
76
+ /** The class's CURIE, the brand of its individuals. */
77
+ readonly curie: C;
78
+ /** The fields, in the order their triples are made. */
79
+ readonly fields: S;
80
+ /** An individual of the class: the subject and its values. */
81
+ readonly make: (subject: Named<C>, values: ValuesOf<S>) => Individual<C, ValuesOf<S>>;
82
+ };
83
+ /** The schema of a class (a term of a vocabulary, whose CURIE brands the individuals) with its fields. */
84
+ export declare function classSchema<const C extends string, const S extends Fields>(cls: VocabularyTerm<never, C>, fields: S): ClassSchema<C, S>;
85
+ /** The schema of an ontology's own description: `owl:Ontology` with its label, description and version. */
86
+ export declare const OwlOntology: ClassSchema<"owl:Ontology", {
87
+ readonly label: Field<LangString, "optional">;
88
+ readonly comment: Field<LangString, "optional">;
89
+ readonly description: Field<LangString, "optional">;
90
+ readonly versionInfo: Field<string, "optional">;
91
+ readonly versionIri: Field<Named<"owl:Ontology">, "optional">;
92
+ }>;
93
+ /** The schema of a class: its label, comment, SKOS definition and superclasses. */
94
+ export declare const OwlClass: ClassSchema<"owl:Class", {
95
+ readonly label: Field<LangString, "optional">;
96
+ readonly comment: Field<LangString, "optional">;
97
+ readonly subClassOf: Field<Named<"owl:Class"> | Named<"rdfs:Class">, "many">;
98
+ readonly definition: Field<LangString, "optional">;
99
+ }>;
100
+ /** The schema of an object property: its label, comment, domain, range and SKOS definition. */
101
+ export declare const ObjectProperty: ClassSchema<"owl:ObjectProperty", {
102
+ readonly label: Field<LangString, "optional">;
103
+ readonly comment: Field<LangString, "optional">;
104
+ readonly domain: Field<Named<"owl:Class"> | Named<"rdfs:Class"> | Named<"rdfs:Datatype">, "optional">;
105
+ readonly range: Field<Named<"owl:Class"> | Named<"rdfs:Class"> | Named<"rdfs:Datatype">, "optional">;
106
+ readonly definition: Field<LangString, "optional">;
107
+ }>;
108
+ /** The schema of a datatype property: its label, comment, domain, range and SKOS definition. */
109
+ export declare const DatatypeProperty: ClassSchema<"owl:DatatypeProperty", {
110
+ readonly label: Field<LangString, "optional">;
111
+ readonly comment: Field<LangString, "optional">;
112
+ readonly domain: Field<Named<"owl:Class"> | Named<"rdfs:Class"> | Named<"rdfs:Datatype">, "optional">;
113
+ readonly range: Field<Named<"owl:Class"> | Named<"rdfs:Class"> | Named<"rdfs:Datatype">, "optional">;
114
+ readonly definition: Field<LangString, "optional">;
115
+ }>;
116
+ /** The named node of the ontology a namespace's terms belong to (`https://example.org/terms` for `https://example.org/terms#`). */
117
+ export declare function ontologyOf(ns: Namespace): Named<"owl:Ontology">;
118
+ /** A code list: individuals of one class keyed by their local names, whose keys' union is the type code branches on. */
119
+ export type CodeList<C extends string, V, K extends string> = {
120
+ readonly [N in K]: Individual<C, V>;
121
+ };
122
+ /** The code list of a schema's class in a namespace: each key is a local name, each value the individual's values. */
123
+ export declare function codes<C extends string, S extends Fields, const E extends Readonly<Record<string, ValuesOf<S>>>>(schema: ClassSchema<C, S>, ns: Namespace, entries: E): CodeList<C, ValuesOf<S>, keyof E & string>;
124
+ /** The key of a code list that names an individual, or nothing where none does. */
125
+ export declare function codeOf<K extends string>(list: {
126
+ readonly [N in K]: Named;
127
+ }, node: Named): K | undefined;
128
+ /** The schema of a SKOS concept scheme: its label and definition. */
129
+ export declare const ConceptSchemeSchema: ClassSchema<"skos:ConceptScheme", {
130
+ readonly prefLabel: Field<LangString, "one">;
131
+ readonly definition: Field<LangString, "optional">;
132
+ }>;
133
+ /** The schema of a SKOS concept: its scheme, notation, label and definition. */
134
+ export declare const ConceptSchema: ClassSchema<"skos:Concept", {
135
+ readonly inScheme: Field<Named<"skos:ConceptScheme">, "one">;
136
+ readonly notation: Field<string, "one">;
137
+ readonly prefLabel: Field<LangString, "one">;
138
+ readonly definition: Field<LangString, "optional">;
139
+ }>;
140
+ /** What one concept of a scheme says beside its notation: its local name in the namespace, its label and its definition. */
141
+ export type ConceptEntry = {
142
+ readonly local: string;
143
+ readonly label: LangString;
144
+ readonly definition?: LangString;
145
+ };
146
+ /** A SKOS concept scheme: the scheme, its concepts by notation, and every individual it states. */
147
+ export type ConceptScheme<N extends string> = {
148
+ /** The scheme itself. */
149
+ readonly scheme: Individual<"skos:ConceptScheme", ValuesOf<typeof ConceptSchemeSchema.fields>>;
150
+ /** Its concepts, by notation. */
151
+ readonly concepts: {
152
+ readonly [K in N]: Individual<"skos:Concept", ValuesOf<typeof ConceptSchema.fields>>;
153
+ };
154
+ /** The scheme and its concepts, in order. */
155
+ readonly individuals: readonly AnyIndividual[];
156
+ };
157
+ /** A SKOS concept scheme in a namespace, its concepts keyed by their notations, whose union is the type of a notation. */
158
+ export declare function conceptScheme<const E extends Readonly<Record<string, ConceptEntry>>>(ns: Namespace, local: string, head: {
159
+ readonly label: LangString;
160
+ readonly definition?: LangString;
161
+ }, entries: E): ConceptScheme<keyof E & string>;
162
+ /** One file of an ontology: its name, the prefixes its Turtle may write, and the individuals it states, in order. */
163
+ export type OntologyFile = {
164
+ readonly name: string;
165
+ readonly prefixes: readonly Namespace[];
166
+ readonly individuals: readonly AnyIndividual[];
167
+ };
168
+ /** The triples of individuals: each individual's statements in order, each triple once, where first stated. */
169
+ export declare function triplesOf(individuals: readonly AnyIndividual[]): readonly Triple[];
170
+ /** What a type cannot state about individuals (or what a run without the type checker lets through): an integer that is not a safe integer, a word not of its field's list, or a subject stated twice. */
171
+ export type RdfFinding = {
172
+ readonly kind: "not-an-integer";
173
+ readonly subject: Iri;
174
+ readonly predicate: Iri;
175
+ readonly value: number;
176
+ } | {
177
+ readonly kind: "not-one-of";
178
+ readonly subject: Iri;
179
+ readonly predicate: Iri;
180
+ readonly value: string;
181
+ readonly words: readonly string[];
182
+ } | {
183
+ readonly kind: "stated-twice";
184
+ readonly subject: Iri;
185
+ };
186
+ /** The sentence a finding is told with. */
187
+ export declare function formatRdfFinding(f: RdfFinding): string;
188
+ /** Every finding about the individuals, in the order they are stated. */
189
+ export declare function validate(individuals: readonly AnyIndividual[]): readonly RdfFinding[];
190
+ export {};
@@ -0,0 +1,162 @@
1
+ /**
2
+ * RDF terms as typed values (commons 0012-ontology FR-001, FR-002): an IRI branded once checked, a namespace that pairs a prefix with
3
+ * its IRI, a named node branded with the classes its term is an individual of, blank nodes, literals typed by their language or their
4
+ * datatype, and triples and quads of them. A vocabulary is a typed value made from a namespace and the local names of its terms, so a
5
+ * term it does not list does not compile. Generalized from erga's ontology DSL (`erga 248-ontology-in-typescript`) and stolos' RDF export.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { en, namespace, vocabulary } from "./rdf-term.js";
10
+ * const ex = vocabulary(namespace("ex", "https://example.org/terms#"), { Widget: "rdfs:Class", size: "rdf:Property" });
11
+ * ex.Widget.iri; // "https://example.org/terms#Widget"
12
+ * en("a widget"); // { kind: "lang", value: "a widget", language: "en" }
13
+ * ```
14
+ *
15
+ * @module
16
+ */
17
+ import { type Result } from "@intellectual-frontiers/core";
18
+ import type { Brand } from "@intellectual-frontiers/core";
19
+ /** An absolute IRI, checked by `parseIri` or made from a namespace. */
20
+ export type Iri = Brand<string, "rdf/Iri">;
21
+ /** Why a text is not an IRI: it has no scheme, or holds a character an IRI may not hold in N-Triples. */
22
+ export type IriError = {
23
+ readonly kind: "not-absolute";
24
+ readonly text: string;
25
+ } | {
26
+ readonly kind: "forbidden-character";
27
+ readonly text: string;
28
+ readonly at: number;
29
+ };
30
+ /** The text as an IRI, or why it is not one. */
31
+ export declare function parseIri(text: string): Result<Iri, IriError>;
32
+ /** The sentence an IRI error is told with. */
33
+ export declare function formatIriError(e: IriError): string;
34
+ /** A fault of the code: a constant namespace or term whose IRI does not parse. It is thrown where the constant is made. */
35
+ export declare class RdfFault extends Error {
36
+ /** The fault, told as a sentence. */
37
+ constructor(message: string);
38
+ }
39
+ /** The classes a named node is an individual of, as the compiler sees them: one key for each class's name. */
40
+ export type Classes<C extends string> = {
41
+ readonly [K in C]: true;
42
+ };
43
+ /**
44
+ * A named node: an IRI, branded with the classes its term is an individual of (by their CURIEs, `"pm:PackageManager"`). A
45
+ * `Named<"a" | "b">` is an individual of both, so it is accepted where either is asked for; a `Named<"a">` is not accepted where `"b"` is,
46
+ * and a `Named` of no known class (`Named`, which is `Named<never>`) is not accepted where any one class is asked for: every named node is
47
+ * a `Named`, so it is the type of a predicate or of any node at all.
48
+ */
49
+ export type Named<C extends string = never> = {
50
+ readonly kind: "named";
51
+ readonly iri: Iri;
52
+ readonly "@ifc/rdf-classes": Classes<C>;
53
+ };
54
+ /** A named node of any one of the classes `C` (`NamedOf<"a" | "b">` is a `Named<"a">` or a `Named<"b">`). */
55
+ export type NamedOf<C extends string> = C extends string ? Named<C> : never;
56
+ /** The named node of an IRI, as an individual of the classes `C`; the brand is for the compiler alone. */
57
+ export declare function named<C extends string = never>(iri: Iri): Named<C>;
58
+ /** A namespace: a prefix and the IRI its terms' local names are appended to. */
59
+ export type Namespace<P extends string = string> = {
60
+ readonly prefix: P;
61
+ readonly iri: Iri;
62
+ };
63
+ /** A namespace; one whose prefix or IRI is not well formed is a fault of the code, thrown as an `RdfFault`. */
64
+ export declare function namespace<const P extends string>(prefix: P, iri: string): Namespace<P>;
65
+ /** The IRI of a local name in a namespace; one that does not parse is a fault of the code, thrown as an `RdfFault`. */
66
+ export declare function iriIn(ns: Namespace, local: string): Iri;
67
+ /**
68
+ * The named node of a local name in a namespace, as an individual of the classes `C`, which the compiler takes from where it is used.
69
+ * It is how a term no module here states is named (an individual of another ontology); a term this code states comes from its schema.
70
+ */
71
+ export declare function term<C extends string = never>(ns: Namespace, local: string): Named<C>;
72
+ /** The IRI of the ontology a namespace's terms belong to: the namespace's IRI without its last `#` or `/`. */
73
+ export declare function ontologyIri(ns: Namespace): Iri;
74
+ /** A term of a vocabulary: a named node of its class, with its CURIE. */
75
+ export type VocabularyTerm<C extends string, Curie extends string> = Named<C> & {
76
+ readonly curie: Curie;
77
+ };
78
+ /** A typed vocabulary: each local name of `T` gives a term of the class `T` names for it. */
79
+ export type Vocabulary<P extends string, T extends Readonly<Record<string, string>>> = {
80
+ readonly [K in keyof T & string]: VocabularyTerm<T[K], `${P}:${K}`>;
81
+ };
82
+ /** The vocabulary of a namespace: its terms by local name, each of the class given (`{ label: "rdf:Property" }`). */
83
+ export declare function vocabulary<const P extends string, const T extends Readonly<Record<string, string>>>(ns: Namespace<P>, terms: T): Vocabulary<P, T>;
84
+ /** A language tag, checked against BCP 47's shape (letters, then subtags of letters and digits, joined by `-`). */
85
+ export type LanguageTag = Brand<string, "rdf/LanguageTag">;
86
+ /** The text as a language tag, in lower case, or nothing where it is not one. */
87
+ export declare function languageTag(text: string): LanguageTag | undefined;
88
+ /** A string in a language: `"install"@en`. */
89
+ export type LangString = {
90
+ readonly kind: "lang";
91
+ readonly value: string;
92
+ readonly language: LanguageTag;
93
+ };
94
+ /** A literal with its datatype (a plain string is an `xsd:string`). */
95
+ export type TypedLiteral = {
96
+ readonly kind: "typed";
97
+ readonly value: string;
98
+ readonly datatype: Iri;
99
+ };
100
+ /** A literal: a string in a language, or a lexical form with its datatype. */
101
+ export type Literal = LangString | TypedLiteral;
102
+ /** A blank node, by its label. */
103
+ export type Blank = {
104
+ readonly kind: "blank";
105
+ readonly label: string;
106
+ };
107
+ /** A node of the default graph's name. */
108
+ export type DefaultGraph = {
109
+ readonly kind: "default";
110
+ };
111
+ /** Any RDF term. */
112
+ export type Term = Named | Blank | Literal;
113
+ /** What a triple may be about. */
114
+ export type Subject = Named | Blank;
115
+ /** A triple. */
116
+ export type Triple = {
117
+ readonly subject: Subject;
118
+ readonly predicate: Named;
119
+ readonly object: Term;
120
+ };
121
+ /** A triple in a named graph, or in the default graph. */
122
+ export type Quad = Triple & {
123
+ readonly graph: Named | DefaultGraph;
124
+ };
125
+ /** Why a literal or a blank node could not be made. */
126
+ export type TermError = {
127
+ readonly kind: "language";
128
+ readonly tag: string;
129
+ } | {
130
+ readonly kind: "blank-label";
131
+ readonly label: string;
132
+ };
133
+ /** The sentence a term error is told with. */
134
+ export declare function formatTermError(e: TermError): string;
135
+ /** A string in the language of a tag, or why the tag is not one. */
136
+ export declare function lang(value: string, tag: string): Result<LangString, TermError>;
137
+ /** A string in English: `en("install")`. */
138
+ export declare function en(value: string): LangString;
139
+ /** The IRI of `xsd:string`. */
140
+ export declare const XSD_STRING: Iri;
141
+ /** The IRI of `xsd:integer`. */
142
+ export declare const XSD_INTEGER: Iri;
143
+ /** The IRI of `xsd:boolean`. */
144
+ export declare const XSD_BOOLEAN: Iri;
145
+ /** The IRI of `rdf:type`. */
146
+ export declare const RDF_TYPE: Iri;
147
+ /** A literal of a datatype: `typed("2026-11-16", xsd.date)`. */
148
+ export declare function typed(value: string, datatype: Named): TypedLiteral;
149
+ /** A plain string, an `xsd:string`. */
150
+ export declare function plain(value: string): TypedLiteral;
151
+ /** A blank node, or why its label is not one. */
152
+ export declare function blank(label: string): Result<Blank, TermError>;
153
+ /** The default graph. */
154
+ export declare const defaultGraph: DefaultGraph;
155
+ /** One value of a field: a plain string, an integer, a boolean, a literal or a named node. */
156
+ export type Value = string | number | boolean | Literal | Named;
157
+ /** The term of a value: a string is an `xsd:string`, a number an `xsd:integer` (in its canonical form), a boolean an `xsd:boolean`. */
158
+ export declare function termOf(v: Value): Term;
159
+ /** A string's characters escaped as N-Triples and Turtle write them, in quotes: `\b \t \n \f \r \" \\` and `\uXXXX` for the other controls. */
160
+ export declare function quoted(s: string): string;
161
+ /** A term as N-Triples writes it: `<iri>`, `_:label`, or a quoted literal with its language or its datatype (none for `xsd:string`). */
162
+ export declare function nTriplesTerm(t: Term): string;
@@ -0,0 +1,148 @@
1
+ /** The namespace of RDF itself. */
2
+ export declare const RDF: import("./rdf-term.js").Namespace<"rdf">;
3
+ /** The terms of `rdf:` that commons states. */
4
+ export declare const rdf: import("./rdf-term.js").Vocabulary<"rdf", {
5
+ readonly type: "rdf:Property";
6
+ readonly first: "rdf:Property";
7
+ readonly rest: "rdf:Property";
8
+ readonly value: "rdf:Property";
9
+ readonly Property: "rdfs:Class";
10
+ readonly List: "rdfs:Class";
11
+ readonly nil: "rdf:List";
12
+ readonly langString: "rdfs:Datatype";
13
+ }>;
14
+ /** The namespace of RDF Schema. */
15
+ export declare const RDFS: import("./rdf-term.js").Namespace<"rdfs">;
16
+ /** The terms of `rdfs:` that commons states. */
17
+ export declare const rdfs: import("./rdf-term.js").Vocabulary<"rdfs", {
18
+ readonly Resource: "rdfs:Class";
19
+ readonly Class: "rdfs:Class";
20
+ readonly Datatype: "rdfs:Class";
21
+ readonly Literal: "rdfs:Class";
22
+ readonly label: "rdf:Property";
23
+ readonly comment: "rdf:Property";
24
+ readonly domain: "rdf:Property";
25
+ readonly range: "rdf:Property";
26
+ readonly subClassOf: "rdf:Property";
27
+ readonly subPropertyOf: "rdf:Property";
28
+ readonly seeAlso: "rdf:Property";
29
+ readonly isDefinedBy: "rdf:Property";
30
+ }>;
31
+ /** The namespace of OWL 2. */
32
+ export declare const OWL: import("./rdf-term.js").Namespace<"owl">;
33
+ /** The terms of `owl:` that commons states. */
34
+ export declare const owl: import("./rdf-term.js").Vocabulary<"owl", {
35
+ readonly Ontology: "rdfs:Class";
36
+ readonly Class: "rdfs:Class";
37
+ readonly ObjectProperty: "rdfs:Class";
38
+ readonly DatatypeProperty: "rdfs:Class";
39
+ readonly AnnotationProperty: "rdfs:Class";
40
+ readonly NamedIndividual: "rdfs:Class";
41
+ readonly Thing: "rdfs:Class";
42
+ readonly versionInfo: "rdf:Property";
43
+ readonly versionIRI: "rdf:Property";
44
+ readonly imports: "rdf:Property";
45
+ readonly sameAs: "rdf:Property";
46
+ readonly equivalentClass: "rdf:Property";
47
+ }>;
48
+ /** The namespace of the XML Schema datatypes. */
49
+ export declare const XSD: import("./rdf-term.js").Namespace<"xsd">;
50
+ /** The datatypes of `xsd:` that commons states. */
51
+ export declare const xsd: import("./rdf-term.js").Vocabulary<"xsd", {
52
+ readonly string: "rdfs:Datatype";
53
+ readonly boolean: "rdfs:Datatype";
54
+ readonly integer: "rdfs:Datatype";
55
+ readonly nonNegativeInteger: "rdfs:Datatype";
56
+ readonly positiveInteger: "rdfs:Datatype";
57
+ readonly decimal: "rdfs:Datatype";
58
+ readonly double: "rdfs:Datatype";
59
+ readonly date: "rdfs:Datatype";
60
+ readonly dateTime: "rdfs:Datatype";
61
+ readonly duration: "rdfs:Datatype";
62
+ readonly anyURI: "rdfs:Datatype";
63
+ readonly language: "rdfs:Datatype";
64
+ }>;
65
+ /** The namespace of SKOS. */
66
+ export declare const SKOS: import("./rdf-term.js").Namespace<"skos">;
67
+ /** The terms of `skos:` that commons states. */
68
+ export declare const skos: import("./rdf-term.js").Vocabulary<"skos", {
69
+ readonly Concept: "rdfs:Class";
70
+ readonly ConceptScheme: "rdfs:Class";
71
+ readonly Collection: "rdfs:Class";
72
+ readonly inScheme: "rdf:Property";
73
+ readonly hasTopConcept: "rdf:Property";
74
+ readonly topConceptOf: "rdf:Property";
75
+ readonly prefLabel: "rdf:Property";
76
+ readonly altLabel: "rdf:Property";
77
+ readonly definition: "rdf:Property";
78
+ readonly notation: "rdf:Property";
79
+ readonly broader: "rdf:Property";
80
+ readonly narrower: "rdf:Property";
81
+ readonly related: "rdf:Property";
82
+ readonly note: "rdf:Property";
83
+ readonly scopeNote: "rdf:Property";
84
+ readonly example: "rdf:Property";
85
+ }>;
86
+ /** The namespace of the Dublin Core terms. */
87
+ export declare const DCTERMS: import("./rdf-term.js").Namespace<"dcterms">;
88
+ /** The terms of `dcterms:` that commons states. */
89
+ export declare const dcterms: import("./rdf-term.js").Vocabulary<"dcterms", {
90
+ readonly identifier: "rdf:Property";
91
+ readonly title: "rdf:Property";
92
+ readonly description: "rdf:Property";
93
+ readonly source: "rdf:Property";
94
+ readonly license: "rdf:Property";
95
+ readonly created: "rdf:Property";
96
+ readonly modified: "rdf:Property";
97
+ readonly date: "rdf:Property";
98
+ readonly creator: "rdf:Property";
99
+ readonly publisher: "rdf:Property";
100
+ readonly isPartOf: "rdf:Property";
101
+ readonly hasPart: "rdf:Property";
102
+ readonly references: "rdf:Property";
103
+ readonly conformsTo: "rdf:Property";
104
+ readonly Standard: "rdfs:Class";
105
+ }>;
106
+ /** The namespace of PROV-O. */
107
+ export declare const PROV: import("./rdf-term.js").Namespace<"prov">;
108
+ /** The terms of `prov:` that commons states: PROV-O's starting point, and where an activity ran. */
109
+ export declare const prov: import("./rdf-term.js").Vocabulary<"prov", {
110
+ readonly Entity: "rdfs:Class";
111
+ readonly Activity: "rdfs:Class";
112
+ readonly Agent: "rdfs:Class";
113
+ readonly Person: "rdfs:Class";
114
+ readonly Organization: "rdfs:Class";
115
+ readonly SoftwareAgent: "rdfs:Class";
116
+ readonly wasGeneratedBy: "rdf:Property";
117
+ readonly wasDerivedFrom: "rdf:Property";
118
+ readonly wasAttributedTo: "rdf:Property";
119
+ readonly wasAssociatedWith: "rdf:Property";
120
+ readonly wasInformedBy: "rdf:Property";
121
+ readonly actedOnBehalfOf: "rdf:Property";
122
+ readonly used: "rdf:Property";
123
+ readonly startedAtTime: "rdf:Property";
124
+ readonly endedAtTime: "rdf:Property";
125
+ readonly generatedAtTime: "rdf:Property";
126
+ readonly atLocation: "rdf:Property";
127
+ readonly value: "rdf:Property";
128
+ }>;
129
+ /** The namespace of SHACL. */
130
+ export declare const SH: import("./rdf-term.js").Namespace<"sh">;
131
+ /** The terms of `sh:` that commons states. */
132
+ export declare const sh: import("./rdf-term.js").Vocabulary<"sh", {
133
+ readonly NodeShape: "rdfs:Class";
134
+ readonly PropertyShape: "rdfs:Class";
135
+ readonly targetClass: "rdf:Property";
136
+ readonly property: "rdf:Property";
137
+ readonly path: "rdf:Property";
138
+ readonly datatype: "rdf:Property";
139
+ readonly class: "rdf:Property";
140
+ readonly node: "rdf:Property";
141
+ readonly minCount: "rdf:Property";
142
+ readonly maxCount: "rdf:Property";
143
+ readonly pattern: "rdf:Property";
144
+ readonly in: "rdf:Property";
145
+ readonly order: "rdf:Property";
146
+ readonly name: "rdf:Property";
147
+ readonly description: "rdf:Property";
148
+ }>;
@@ -0,0 +1,25 @@
1
+ import { type Namespace, type Quad, type Triple } from "./rdf-term.js";
2
+ /** Two strings in the order of their code points (JavaScript's `<` orders UTF-16 units, which differs above U+FFFF). */
3
+ export declare function compareCodePoints(a: string, b: string): number;
4
+ /** Triples as N-Triples: each once, one a line, the lines in the order of their code points. */
5
+ export declare function nTriples(triples: readonly Triple[]): string;
6
+ /** Quads as N-Quads: each once, one a line (a triple of the default graph has no fourth term), in the order of their code points. */
7
+ export declare function nQuads(quads: readonly Quad[]): string;
8
+ /** What a Turtle document is made of: comment lines for its head, the prefixes it may use, and its triples. */
9
+ export type TurtleDocument = {
10
+ readonly comments?: readonly string[];
11
+ readonly prefixes: readonly Namespace[];
12
+ readonly triples: readonly Triple[];
13
+ };
14
+ /**
15
+ * Triples as Turtle in its canonical form: the comment lines, then the prefixes sorted by name, then the subjects in the order of their
16
+ * N-Triples terms, each with its `rdf:type` first as `a` and its other predicates by IRI, each predicate's objects in the order of their
17
+ * N-Triples terms, one blank line between subjects. An IRI is a prefixed name where a prefix's IRI starts it and the rest is a plain local
18
+ * name (the longest such prefix), and a whole IRI otherwise; an integer or a boolean of canonical form is written bare.
19
+ */
20
+ export declare function turtle(doc: TurtleDocument): string;
21
+ /**
22
+ * Triples as JSON-LD in its expanded form: one node object for each subject, in the order of their N-Triples terms, with its `@id`, its
23
+ * `@type` (the IRIs of its `rdf:type`s, sorted) and then each other predicate by IRI, its values in the order of their N-Triples terms.
24
+ */
25
+ export declare function jsonLd(triples: readonly Triple[]): string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * RDF as algebraically typed values, and the writers of its syntaxes (commons 0012-ontology): IRIs branded once checked, namespaces and
3
+ * typed vocabularies (RDF, RDFS, OWL, XSD, SKOS, Dublin Core terms, PROV-O, SHACL), named nodes branded with their classes, literals typed
4
+ * by language or datatype, class schemas whose individuals' types are derived from them, code lists and SKOS concept schemes, the checks a
5
+ * type cannot state, and N-Triples, N-Quads, canonical Turtle and expanded JSON-LD. A harness states its ontology as TypeScript with these,
6
+ * and every RDF form of it is written, never read.
7
+ *
8
+ * @remarks
9
+ * Generalized from erga's ontology DSL (`erga 248-ontology-in-typescript`), whose references are branded by class and whose Turtle is
10
+ * written in one canonical form, and from stolos' PROV export, which wrote Turtle by hand. None of their vocabularies is here: a harness
11
+ * keeps its own, made with `vocabulary`.
12
+ *
13
+ * @limits
14
+ * It reads no RDF syntax, holds no blank-node values or RDF lists in a schema's fields, makes no SHACL shapes and compares no graphs with
15
+ * blank nodes.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { classSchema, en, namespace, one, OwlClass, range, rdfs, term, triplesOf, turtle, vocabulary } from "./rdf.js";
20
+ * const EX = namespace("ex", "https://example.org/terms#");
21
+ * const ex = vocabulary(EX, { Tool: "owl:Class", runs: "owl:DatatypeProperty" });
22
+ * const Tool = classSchema(ex.Tool, { label: one(rdfs.label, range.langString), runs: one(ex.runs, range.string) });
23
+ * const git = Tool.make(term(EX, "git"), { label: en("git"), runs: "git" });
24
+ * turtle({ prefixes: [EX], triples: triplesOf([OwlClass.make(ex.Tool, { label: en("Tool") }), git]) });
25
+ * ```
26
+ *
27
+ * @module
28
+ */
29
+ export { blank, defaultGraph, en, formatIriError, formatTermError, iriIn, lang, languageTag, named, namespace, nTriplesTerm, ontologyIri, parseIri, plain, quoted, RDF_TYPE, RdfFault, term, termOf, typed, vocabulary, XSD_BOOLEAN, XSD_INTEGER, XSD_STRING, } from "./rdf-term.js";
30
+ export type { Blank, Classes, DefaultGraph, Iri, IriError, LangString, LanguageTag, Literal, Named, NamedOf, Namespace, Quad, Subject, Term, TermError, Triple, TypedLiteral, Value, Vocabulary, VocabularyTerm, } from "./rdf-term.js";
31
+ export { DCTERMS, dcterms, OWL, owl, PROV, prov, RDF, rdf, RDFS, rdfs, SH, sh, SKOS, skos, XSD, xsd } from "./rdf-vocabularies.js";
32
+ export { classSchema, codeOf, codes, ConceptSchema, conceptScheme, ConceptSchemeSchema, DatatypeProperty, formatRdfFinding, many, ObjectProperty, one, ontologyOf, optional, OwlClass, OwlOntology, range, triplesOf, validate, } from "./rdf-schema.js";
33
+ export type { AnyIndividual, Cardinality, ClassSchema, CodeList, ConceptEntry, ConceptScheme, Field, Fields, Individual, OntologyFile, Range, RangeKind, RdfFinding, Statement, ValuesOf, } from "./rdf-schema.js";
34
+ export { compareCodePoints, jsonLd, nQuads, nTriples, turtle } from "./rdf-write.js";
35
+ export type { TurtleDocument } from "./rdf-write.js";