@dxos/echo-memory 0.0.0-stage → 0.0.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 (147) hide show
  1. package/LICENSE +105 -0
  2. package/dist/lib/Fact.mjs +1 -0
  3. package/dist/lib/FactFeed.mjs +1 -0
  4. package/dist/lib/Graph.mjs +1 -0
  5. package/dist/lib/Hash.mjs +1 -0
  6. package/dist/lib/Mapping.mjs +1 -0
  7. package/dist/lib/MemoryError.mjs +1 -0
  8. package/dist/lib/MemoryQuery.mjs +1 -0
  9. package/dist/lib/MemoryService.mjs +1 -0
  10. package/dist/lib/Ontology.mjs +1 -0
  11. package/dist/lib/Pipeline.mjs +1 -0
  12. package/dist/lib/Predicate.mjs +1 -0
  13. package/dist/lib/Rdf.mjs +1 -0
  14. package/dist/lib/RdfStore.mjs +1 -0
  15. package/dist/lib/Sparql.mjs +1 -0
  16. package/dist/lib/Subscription.mjs +1 -0
  17. package/dist/lib/Trig.mjs +1 -0
  18. package/dist/lib/Vocab.mjs +1 -0
  19. package/dist/lib/Vocabularies.mjs +1 -0
  20. package/dist/lib/chunk-Fact.mjs +245 -0
  21. package/dist/lib/chunk-Fact.mjs.map +1 -0
  22. package/dist/lib/chunk-FactFeed.mjs +29 -0
  23. package/dist/lib/chunk-FactFeed.mjs.map +1 -0
  24. package/dist/lib/chunk-Graph.mjs +147 -0
  25. package/dist/lib/chunk-Graph.mjs.map +1 -0
  26. package/dist/lib/chunk-Hash.mjs +16 -0
  27. package/dist/lib/chunk-Hash.mjs.map +1 -0
  28. package/dist/lib/chunk-Mapping.mjs +226 -0
  29. package/dist/lib/chunk-Mapping.mjs.map +1 -0
  30. package/dist/lib/chunk-MemoryError.mjs +10 -0
  31. package/dist/lib/chunk-MemoryError.mjs.map +1 -0
  32. package/dist/lib/chunk-MemoryQuery.mjs +99 -0
  33. package/dist/lib/chunk-MemoryQuery.mjs.map +1 -0
  34. package/dist/lib/chunk-MemoryService.mjs +31 -0
  35. package/dist/lib/chunk-MemoryService.mjs.map +1 -0
  36. package/dist/lib/chunk-Ontology.mjs +529 -0
  37. package/dist/lib/chunk-Ontology.mjs.map +1 -0
  38. package/dist/lib/chunk-Pipeline.mjs +84 -0
  39. package/dist/lib/chunk-Pipeline.mjs.map +1 -0
  40. package/dist/lib/chunk-Predicate.mjs +66 -0
  41. package/dist/lib/chunk-Predicate.mjs.map +1 -0
  42. package/dist/lib/chunk-Rdf.mjs +120 -0
  43. package/dist/lib/chunk-Rdf.mjs.map +1 -0
  44. package/dist/lib/chunk-RdfStore.mjs +60 -0
  45. package/dist/lib/chunk-RdfStore.mjs.map +1 -0
  46. package/dist/lib/chunk-Sparql.mjs +153 -0
  47. package/dist/lib/chunk-Sparql.mjs.map +1 -0
  48. package/dist/lib/chunk-Subscription.mjs +44 -0
  49. package/dist/lib/chunk-Subscription.mjs.map +1 -0
  50. package/dist/lib/chunk-Trig.mjs +106 -0
  51. package/dist/lib/chunk-Trig.mjs.map +1 -0
  52. package/dist/lib/chunk-Vocab.mjs +164 -0
  53. package/dist/lib/chunk-Vocab.mjs.map +1 -0
  54. package/dist/lib/chunk-Vocabularies.mjs +343 -0
  55. package/dist/lib/chunk-Vocabularies.mjs.map +1 -0
  56. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  57. package/dist/lib/index.mjs +19 -0
  58. package/dist/types/src/Fact.d.ts +339 -0
  59. package/dist/types/src/Fact.d.ts.map +1 -0
  60. package/dist/types/src/Fact.test.d.ts +2 -0
  61. package/dist/types/src/Fact.test.d.ts.map +1 -0
  62. package/dist/types/src/FactFeed.d.ts +11 -0
  63. package/dist/types/src/FactFeed.d.ts.map +1 -0
  64. package/dist/types/src/FactFeed.test.d.ts +2 -0
  65. package/dist/types/src/FactFeed.test.d.ts.map +1 -0
  66. package/dist/types/src/Graph.d.ts +31 -0
  67. package/dist/types/src/Graph.d.ts.map +1 -0
  68. package/dist/types/src/Graph.test.d.ts +2 -0
  69. package/dist/types/src/Graph.test.d.ts.map +1 -0
  70. package/dist/types/src/Hash.d.ts +3 -0
  71. package/dist/types/src/Hash.d.ts.map +1 -0
  72. package/dist/types/src/Mapping.d.ts +18 -0
  73. package/dist/types/src/Mapping.d.ts.map +1 -0
  74. package/dist/types/src/Mapping.test.d.ts +2 -0
  75. package/dist/types/src/Mapping.test.d.ts.map +1 -0
  76. package/dist/types/src/MemoryError.d.ts +33 -0
  77. package/dist/types/src/MemoryError.d.ts.map +1 -0
  78. package/dist/types/src/MemoryQuery.d.ts +136 -0
  79. package/dist/types/src/MemoryQuery.d.ts.map +1 -0
  80. package/dist/types/src/MemoryQuery.test.d.ts +2 -0
  81. package/dist/types/src/MemoryQuery.test.d.ts.map +1 -0
  82. package/dist/types/src/MemoryService.d.ts +72 -0
  83. package/dist/types/src/MemoryService.d.ts.map +1 -0
  84. package/dist/types/src/Ontology.d.ts +115 -0
  85. package/dist/types/src/Ontology.d.ts.map +1 -0
  86. package/dist/types/src/Ontology.test.d.ts +2 -0
  87. package/dist/types/src/Ontology.test.d.ts.map +1 -0
  88. package/dist/types/src/Pipeline.d.ts +103 -0
  89. package/dist/types/src/Pipeline.d.ts.map +1 -0
  90. package/dist/types/src/Predicate.d.ts +17 -0
  91. package/dist/types/src/Predicate.d.ts.map +1 -0
  92. package/dist/types/src/Predicate.test.d.ts +2 -0
  93. package/dist/types/src/Predicate.test.d.ts.map +1 -0
  94. package/dist/types/src/Rdf.d.ts +33 -0
  95. package/dist/types/src/Rdf.d.ts.map +1 -0
  96. package/dist/types/src/Rdf.test.d.ts +2 -0
  97. package/dist/types/src/Rdf.test.d.ts.map +1 -0
  98. package/dist/types/src/RdfStore.d.ts +471 -0
  99. package/dist/types/src/RdfStore.d.ts.map +1 -0
  100. package/dist/types/src/Sparql.d.ts +58 -0
  101. package/dist/types/src/Sparql.d.ts.map +1 -0
  102. package/dist/types/src/Sparql.test.d.ts +2 -0
  103. package/dist/types/src/Sparql.test.d.ts.map +1 -0
  104. package/dist/types/src/Subscription.d.ts +100 -0
  105. package/dist/types/src/Subscription.d.ts.map +1 -0
  106. package/dist/types/src/Trig.d.ts +8 -0
  107. package/dist/types/src/Trig.d.ts.map +1 -0
  108. package/dist/types/src/Trig.test.d.ts +2 -0
  109. package/dist/types/src/Trig.test.d.ts.map +1 -0
  110. package/dist/types/src/Vocab.d.ts +90 -0
  111. package/dist/types/src/Vocab.d.ts.map +1 -0
  112. package/dist/types/src/Vocabularies.d.ts +45 -0
  113. package/dist/types/src/Vocabularies.d.ts.map +1 -0
  114. package/dist/types/src/index.d.ts +19 -0
  115. package/dist/types/src/index.d.ts.map +1 -0
  116. package/dist/types/tsconfig.tsbuildinfo +1 -0
  117. package/package.json +133 -3
  118. package/src/Fact.test.ts +74 -0
  119. package/src/Fact.ts +269 -0
  120. package/src/FactFeed.test.ts +40 -0
  121. package/src/FactFeed.ts +38 -0
  122. package/src/Graph.test.ts +106 -0
  123. package/src/Graph.ts +158 -0
  124. package/src/Hash.ts +15 -0
  125. package/src/Mapping.test.ts +197 -0
  126. package/src/Mapping.ts +320 -0
  127. package/src/MemoryError.ts +10 -0
  128. package/src/MemoryQuery.test.ts +67 -0
  129. package/src/MemoryQuery.ts +114 -0
  130. package/src/MemoryService.ts +89 -0
  131. package/src/Ontology.test.ts +94 -0
  132. package/src/Ontology.ts +571 -0
  133. package/src/Pipeline.ts +97 -0
  134. package/src/Predicate.test.ts +47 -0
  135. package/src/Predicate.ts +89 -0
  136. package/src/Rdf.test.ts +104 -0
  137. package/src/Rdf.ts +158 -0
  138. package/src/RdfStore.ts +111 -0
  139. package/src/Sparql.test.ts +72 -0
  140. package/src/Sparql.ts +237 -0
  141. package/src/Subscription.ts +47 -0
  142. package/src/Trig.test.ts +199 -0
  143. package/src/Trig.ts +170 -0
  144. package/src/Vocab.ts +134 -0
  145. package/src/Vocabularies.ts +204 -0
  146. package/src/index.ts +22 -0
  147. package/README.md +0 -3
@@ -0,0 +1,529 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { r as normalize } from "./chunk-Predicate.mjs";
3
+ import { i as Rdf_exports } from "./chunk-Rdf.mjs";
4
+ import { C as RDFS_DOMAIN, D as RDF_PROPERTY, E as RDFS_RANGE, L as SX_SHORTHAND, M as SKOS_ALT_LABEL, N as SKOS_EXAMPLE, O as RDF_TYPE, S as RDFS_COMMENT, T as RDFS_LABEL, _ as OWL_INVERSE_OF, a as DCTERMS_IS_REPLACED_BY, b as RDF, d as LOCAL_BRAIN, f as ONTOLOGY_GRAPH, g as OWL_EQUIVALENT_PROPERTY, h as OWL_DEPRECATED, i as DCTERMS_CREATOR, j as SKOS, k as SCHEMA, l as FOAF, m as OWL, n as DCTERMS, o as DX, p as ORG, r as DCTERMS_CREATED, v as OWL_SAME_AS, w as RDFS_IS_DEFINED_BY, x as RDFS, z as XSD } from "./chunk-Vocab.mjs";
5
+ //#region src/Ontology.ts
6
+ var Ontology_exports = /* @__PURE__ */ __exportAll({
7
+ DEFAULT: () => DEFAULT,
8
+ DEFAULT_ENTRIES: () => DEFAULT_ENTRIES,
9
+ Ontology: () => Ontology,
10
+ entry: () => entry,
11
+ fromQuads: () => fromQuads,
12
+ iriFor: () => iriFor,
13
+ key: () => key,
14
+ labelFromIri: () => labelFromIri,
15
+ make: () => make,
16
+ nameFor: () => nameFor,
17
+ ontologyQuads: () => ontologyQuads,
18
+ toQuads: () => toQuads
19
+ });
20
+ var { quad, namedNode, literal } = Rdf_exports;
21
+ /**
22
+ * The lookup key for a surface predicate: pipeline-rdf's relation key (case, auxiliaries and head-verb
23
+ * inflection collapse) with words joined by `_`, so `Will-Work-On`, `working on` and `works_on` compare equal.
24
+ */
25
+ var key = (surface) => normalize(words(surface)).replace(/\s+/g, "_");
26
+ /**
27
+ * The shorthand a surface predicate is minted under: {@link key} without stemming, since the stem is a matching key
28
+ * nobody reads (`changed` keys to `chang`) while the shorthand names the predicate in its IRI and in rules.
29
+ */
30
+ var nameFor = (surface) => normalize(words(surface), { stem: false }).replace(/\s+/g, "_");
31
+ var words = (surface) => surface.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ");
32
+ var camel = (name) => name.replace(/_([a-z0-9])/g, (_, char) => char.toUpperCase());
33
+ /** The IRI a predicate shorthand mints to in a namespace, e.g. `works_on` → `dx:worksOn`. */
34
+ var iriFor = (name, namespace = DX) => `${namespace}${camel(name)}`;
35
+ /** An entry for a predicate shorthand; the IRI defaults to the `dx:` vocabulary. */
36
+ var entry = (name, options = {}) => ({
37
+ ...options,
38
+ iri: options.iri ?? iriFor(name),
39
+ name,
40
+ label: options.label ?? name.replace(/_/g, " "),
41
+ definedBy: options.definedBy ?? (options.iri === void 0 ? "https://dxos.org/ontology/" : void 0)
42
+ });
43
+ /**
44
+ * An extensible set of predicates. A surface form the ontology does not know mints a predicate in the ontology's
45
+ * namespace (its brain's) from its relation key, so two documents that phrase a relation the same way still share
46
+ * one predicate, and a predicate one brain invented never poses as a shared vocabulary term.
47
+ */
48
+ var Ontology = class Ontology {
49
+ entries;
50
+ namespace;
51
+ #byKey = /* @__PURE__ */ new Map();
52
+ #byIri = /* @__PURE__ */ new Map();
53
+ /** @throws Error when two entries claim one surface form or one IRI. */
54
+ constructor(entries, { namespace = LOCAL_BRAIN } = {}) {
55
+ this.entries = entries;
56
+ this.namespace = namespace;
57
+ for (const entry of entries) {
58
+ if (this.#byIri.has(entry.iri)) throw new Error(`Predicate defined twice: ${entry.iri}`);
59
+ this.#byIri.set(entry.iri, entry);
60
+ }
61
+ for (const entry of entries) for (const equivalent of entry.equivalents ?? []) if (!this.#byIri.has(equivalent)) this.#byIri.set(equivalent, entry);
62
+ for (const entry of entries) {
63
+ if (entry.replacedBy !== void 0) continue;
64
+ for (const surface of [
65
+ entry.name,
66
+ entry.label,
67
+ ...entry.synonyms ?? []
68
+ ]) {
69
+ const existing = this.#byKey.get(key(surface));
70
+ if (existing !== void 0 && existing.iri !== entry.iri) throw new Error(`Synonym ${surface} maps to both ${existing.name} and ${entry.name}`);
71
+ this.#byKey.set(key(surface), entry);
72
+ }
73
+ }
74
+ }
75
+ /** The entry a surface form names, if the ontology knows it. */
76
+ find(surface) {
77
+ return this.#byKey.get(key(surface));
78
+ }
79
+ /** The entry for an IRI (its own, or one it is equivalent to), if the ontology defines it. */
80
+ get(iri) {
81
+ return this.#byIri.get(iri);
82
+ }
83
+ /** The entry an IRI stands for: a merged-away predicate's survivor, else its own entry. */
84
+ canonical(iri) {
85
+ let entry = this.get(iri);
86
+ const seen = /* @__PURE__ */ new Set();
87
+ while (entry?.replacedBy !== void 0 && !seen.has(entry.iri)) {
88
+ seen.add(entry.iri);
89
+ entry = this.get(entry.replacedBy) ?? entry;
90
+ }
91
+ return entry;
92
+ }
93
+ /** The IRIs a query for this predicate matches: its own and every equivalent, either way round. */
94
+ equivalents(iri) {
95
+ const entry = this.canonical(iri);
96
+ const iris = /* @__PURE__ */ new Set([iri]);
97
+ if (entry) {
98
+ iris.add(entry.iri);
99
+ for (const equivalent of entry.equivalents ?? []) iris.add(equivalent);
100
+ for (const other of this.entries) if (other.replacedBy === entry.iri) iris.add(other.iri);
101
+ }
102
+ return iris;
103
+ }
104
+ /** The entry for a surface form; one the ontology does not know is minted in its namespace, labelled with the form. */
105
+ resolve(surface) {
106
+ const known = this.find(surface);
107
+ if (known) return known;
108
+ const name = nameFor(surface);
109
+ return {
110
+ iri: iriFor(name, this.namespace),
111
+ name,
112
+ label: surface.trim(),
113
+ definedBy: this.namespace
114
+ };
115
+ }
116
+ /** A new ontology with these entries added; an entry for a known IRI replaces it. */
117
+ extend(entries) {
118
+ const iris = new Set(entries.map(({ iri }) => iri));
119
+ return new Ontology([...this.entries.filter(({ iri }) => !iris.has(iri)), ...entries], { namespace: this.namespace });
120
+ }
121
+ /**
122
+ * A new ontology with the predicates a brain has learned added: unlike {@link extend}, an entry this ontology
123
+ * already defines, or whose surface form it already maps, is skipped rather than rejected, since a store may hold
124
+ * predicates minted before the seed vocabulary named them.
125
+ */
126
+ include(entries) {
127
+ const learned = [];
128
+ const surfaces = /* @__PURE__ */ new Set();
129
+ for (const entry of entries) {
130
+ const forms = [
131
+ entry.name,
132
+ entry.label,
133
+ ...entry.synonyms ?? []
134
+ ].map(key);
135
+ if (this.get(entry.iri) || forms.some((form) => this.#byKey.has(form) || surfaces.has(form))) continue;
136
+ forms.forEach((form) => surfaces.add(form));
137
+ learned.push(entry);
138
+ }
139
+ return learned.length === 0 ? this : this.extend(learned);
140
+ }
141
+ /** The same predicates, minting new ones in another namespace. */
142
+ withNamespace(namespace) {
143
+ return new Ontology(this.entries, { namespace });
144
+ }
145
+ /**
146
+ * Merges one predicate into another: the survivor gains the other's IRI as an equivalent and its surface forms as
147
+ * synonyms, and the other is kept, deprecated, so stored statements made with it still read and match.
148
+ * @throws Error when either IRI is not an entry of this ontology.
149
+ */
150
+ merge(from, into) {
151
+ const source = this.entries.find(({ iri }) => iri === from);
152
+ const target = this.entries.find(({ iri }) => iri === into);
153
+ if (!source || !target) throw new Error(`Cannot merge ${from} into ${into}: both must be defined.`);
154
+ const forms = new Set([
155
+ target.name,
156
+ target.label,
157
+ ...target.synonyms ?? []
158
+ ].map(key));
159
+ const merged = {
160
+ ...target,
161
+ synonyms: [...target.synonyms ?? [], ...[
162
+ source.name,
163
+ source.label,
164
+ ...source.synonyms ?? []
165
+ ].filter((form) => !forms.has(key(form)))].filter((form, index, all) => all.findIndex((other) => key(other) === key(form)) === index),
166
+ equivalents: [.../* @__PURE__ */ new Set([
167
+ ...target.equivalents ?? [],
168
+ source.iri,
169
+ ...source.equivalents ?? []
170
+ ])]
171
+ };
172
+ const deprecated = {
173
+ ...source,
174
+ synonyms: [],
175
+ equivalents: [],
176
+ replacedBy: into
177
+ };
178
+ return new Ontology(this.entries.map((entry) => entry.iri === into ? merged : entry.iri === from ? deprecated : entry), { namespace: this.namespace });
179
+ }
180
+ };
181
+ /** Creates an ontology. */
182
+ var make = (entries, options) => new Ontology(entries, options);
183
+ /** The label an IRI reads as when no ontology defines it: its local name, split into words. */
184
+ var labelFromIri = (iri) => iri.replace(/^.*[#/]/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase();
185
+ var ontologyGraph = () => namedNode(ONTOLOGY_GRAPH);
186
+ /** The entry as quads in the ontology graph. */
187
+ var toQuads = (entry) => {
188
+ const subject = namedNode(entry.iri);
189
+ const quads = [];
190
+ const add = (predicate, object) => quads.push(quad(subject, namedNode(predicate), object, ontologyGraph()));
191
+ add(RDF_TYPE, namedNode(RDF_PROPERTY));
192
+ add(RDFS_LABEL, literal(entry.label));
193
+ add(SX_SHORTHAND, literal(entry.name));
194
+ for (const synonym of entry.synonyms ?? []) add(SKOS_ALT_LABEL, literal(synonym));
195
+ const iris = [
196
+ [RDFS_DOMAIN, entry.domain],
197
+ [RDFS_RANGE, entry.range],
198
+ [OWL_INVERSE_OF, entry.inverse],
199
+ [RDFS_IS_DEFINED_BY, entry.definedBy],
200
+ [DCTERMS_IS_REPLACED_BY, entry.replacedBy]
201
+ ];
202
+ for (const [predicate, value] of iris) if (value !== void 0) add(predicate, namedNode(value));
203
+ for (const equivalent of entry.equivalents ?? []) add(OWL_EQUIVALENT_PROPERTY, namedNode(equivalent));
204
+ const literals = [
205
+ [RDFS_COMMENT, entry.description],
206
+ [DCTERMS_CREATED, entry.created],
207
+ [DCTERMS_CREATOR, entry.creator],
208
+ [SKOS_EXAMPLE, entry.example]
209
+ ];
210
+ for (const [predicate, value] of literals) if (value !== void 0) add(predicate, literal(value));
211
+ if (entry.replacedBy !== void 0) add(OWL_DEPRECATED, literal("true", namedNode(`${XSD}boolean`)));
212
+ return quads;
213
+ };
214
+ /**
215
+ * The entries described in the ontology graph, one per subject; the inverse of {@link toQuads}. A predicate known
216
+ * only by its label (as facts store a minted one) reads with the shorthand its label keys to. Multi-valued fields
217
+ * keep their first value where an entry holds one value.
218
+ */
219
+ var fromQuads = (quads) => {
220
+ const subjects = /* @__PURE__ */ new Map();
221
+ for (const entry of quads) {
222
+ if (entry.graph.value !== "https://dxos.org/semantic/graph/ontology" || entry.subject.termType !== "NamedNode") continue;
223
+ let props = subjects.get(entry.subject.value);
224
+ if (!props) subjects.set(entry.subject.value, props = /* @__PURE__ */ new Map());
225
+ const values = props.get(entry.predicate.value) ?? [];
226
+ if (!values.includes(entry.object.value)) props.set(entry.predicate.value, [...values, entry.object.value]);
227
+ }
228
+ return [...subjects].flatMap(([iri, props]) => {
229
+ const one = (predicate) => props.get(predicate)?.[0];
230
+ const many = (predicate) => props.get(predicate) ?? [];
231
+ const label = one("http://www.w3.org/2000/01/rdf-schema#label") ?? labelFromIri(iri);
232
+ const optional = {
233
+ synonyms: many(SKOS_ALT_LABEL),
234
+ equivalents: many(OWL_EQUIVALENT_PROPERTY),
235
+ description: one(RDFS_COMMENT),
236
+ domain: one(RDFS_DOMAIN),
237
+ range: one(RDFS_RANGE),
238
+ inverse: one(OWL_INVERSE_OF),
239
+ definedBy: one(RDFS_IS_DEFINED_BY),
240
+ created: one(DCTERMS_CREATED),
241
+ creator: one(DCTERMS_CREATOR),
242
+ example: one(SKOS_EXAMPLE),
243
+ replacedBy: one(DCTERMS_IS_REPLACED_BY)
244
+ };
245
+ return [{
246
+ iri,
247
+ name: one("https://dxos.org/semantic#shorthand") ?? nameFor(label),
248
+ label,
249
+ ...Object.fromEntries(Object.entries(optional).filter(([, value]) => Array.isArray(value) ? value.length > 0 : value !== void 0))
250
+ }];
251
+ });
252
+ };
253
+ /** Every entry of the ontology as quads in the ontology graph. */
254
+ var ontologyQuads = (ontology) => ontology.entries.flatMap(toQuads);
255
+ var schema = (name) => `${SCHEMA}${name}`;
256
+ var dx = (name) => `${DX}${name}`;
257
+ var PERSON = schema("Person");
258
+ var ORGANIZATION = schema("Organization");
259
+ var PLACE = schema("Place");
260
+ /** The starter predicates: people and organizations, plus the relations agent goals are written against. */
261
+ var DEFAULT_ENTRIES = [
262
+ entry("is_a", {
263
+ iri: RDF_TYPE,
264
+ label: "is a",
265
+ synonyms: ["is an", "is instance of"],
266
+ description: "A class the subject is an instance of: \"Socrates is a man\".",
267
+ definedBy: RDF,
268
+ equivalents: [dx("isA")]
269
+ }),
270
+ entry("kind_of", {
271
+ iri: `${RDFS}subClassOf`,
272
+ label: "kind of",
273
+ synonyms: [
274
+ "is kind of",
275
+ "is type of",
276
+ "is a type of",
277
+ "subclass of"
278
+ ],
279
+ description: "A broader class every instance of the subject class belongs to: \"a philosopher is a kind of thinker\".",
280
+ definedBy: RDFS
281
+ }),
282
+ entry("same_as", {
283
+ iri: OWL_SAME_AS,
284
+ label: "same as",
285
+ synonyms: [
286
+ "also known as",
287
+ "aka",
288
+ "is the same as"
289
+ ],
290
+ description: "The subject and object are one and the same entity.",
291
+ definedBy: OWL
292
+ }),
293
+ entry("has_role", {
294
+ iri: schema("jobTitle"),
295
+ label: "has role",
296
+ synonyms: [
297
+ "works as",
298
+ "is on the team as",
299
+ "role",
300
+ "job title"
301
+ ],
302
+ description: "The role or job title the subject holds.",
303
+ domain: PERSON,
304
+ definedBy: SCHEMA,
305
+ equivalents: [dx("hasRole")]
306
+ }),
307
+ entry("member_of", {
308
+ iri: schema("memberOf"),
309
+ synonyms: [
310
+ "belongs to",
311
+ "is member of",
312
+ "is on the team",
313
+ "is on team"
314
+ ],
315
+ description: "The organization or team the subject belongs to.",
316
+ domain: PERSON,
317
+ range: ORGANIZATION,
318
+ inverse: schema("member"),
319
+ definedBy: SCHEMA,
320
+ equivalents: [dx("memberOf"), `${ORG}memberOf`]
321
+ }),
322
+ entry("has_member", {
323
+ iri: schema("member"),
324
+ description: "A member of the organization or team.",
325
+ domain: ORGANIZATION,
326
+ range: PERSON,
327
+ inverse: schema("memberOf"),
328
+ definedBy: SCHEMA,
329
+ equivalents: [dx("hasMember"), `${ORG}hasMember`]
330
+ }),
331
+ entry("works_for", {
332
+ iri: schema("worksFor"),
333
+ synonyms: [
334
+ "works at",
335
+ "employed by",
336
+ "is employed at"
337
+ ],
338
+ description: "The organization that employs the subject.",
339
+ domain: PERSON,
340
+ range: ORGANIZATION,
341
+ definedBy: SCHEMA
342
+ }),
343
+ entry("founded", {
344
+ synonyms: [
345
+ "is founder of",
346
+ "established",
347
+ "started"
348
+ ],
349
+ description: "An organization the subject founded; schema.org states it the other way round (`schema:founder`).",
350
+ domain: PERSON,
351
+ range: ORGANIZATION,
352
+ inverse: schema("founder")
353
+ }),
354
+ entry("alumni_of", {
355
+ iri: schema("alumniOf"),
356
+ label: "alumni of",
357
+ synonyms: ["studied at", "graduated from"],
358
+ description: "A school or organization (never a person) the subject studied at or was formerly part of.",
359
+ domain: PERSON,
360
+ range: ORGANIZATION,
361
+ definedBy: SCHEMA
362
+ }),
363
+ entry("knows_about", {
364
+ iri: schema("knowsAbout"),
365
+ synonyms: [
366
+ "is expert in",
367
+ "is the one to ask about",
368
+ "expert in",
369
+ "specializes in"
370
+ ],
371
+ description: "An area the subject can answer questions about.",
372
+ definedBy: SCHEMA,
373
+ equivalents: [dx("knowsAbout")]
374
+ }),
375
+ entry("located_in", {
376
+ iri: schema("location"),
377
+ synonyms: [
378
+ "lives in",
379
+ "is based in",
380
+ "based in",
381
+ "is located in"
382
+ ],
383
+ description: "Where the subject is.",
384
+ range: PLACE,
385
+ definedBy: SCHEMA,
386
+ equivalents: [dx("locatedIn")]
387
+ }),
388
+ entry("born_in", {
389
+ iri: schema("birthPlace"),
390
+ synonyms: ["was born in", "birthplace"],
391
+ description: "The place the subject was born.",
392
+ domain: PERSON,
393
+ range: PLACE,
394
+ definedBy: SCHEMA
395
+ }),
396
+ entry("about", {
397
+ iri: schema("about"),
398
+ synonyms: [
399
+ "is about",
400
+ "concerns",
401
+ "covers"
402
+ ],
403
+ description: "The topic a document, message or event is about.",
404
+ definedBy: SCHEMA
405
+ }),
406
+ entry("mentions", {
407
+ iri: schema("mentions"),
408
+ synonyms: ["refers to", "cites"],
409
+ description: "An entity a document or message mentions without being about it.",
410
+ definedBy: SCHEMA
411
+ }),
412
+ entry("text", {
413
+ iri: schema("text"),
414
+ label: "has text",
415
+ synonyms: ["wording"],
416
+ description: "The wording of a message, question or document.",
417
+ definedBy: SCHEMA
418
+ }),
419
+ entry("knows", {
420
+ iri: `${FOAF}knows`,
421
+ synonyms: [
422
+ "is friends with",
423
+ "is acquainted with",
424
+ "met"
425
+ ],
426
+ description: "A person the subject knows.",
427
+ domain: PERSON,
428
+ range: PERSON,
429
+ definedBy: FOAF,
430
+ equivalents: [schema("knows")]
431
+ }),
432
+ entry("has_account", {
433
+ iri: `${FOAF}account`,
434
+ synonyms: [
435
+ "is on discord as",
436
+ "username",
437
+ "handle"
438
+ ],
439
+ description: "An account the subject uses, such as a Discord username.",
440
+ definedBy: FOAF,
441
+ equivalents: [dx("hasAccount")]
442
+ }),
443
+ entry("created_by", {
444
+ iri: `${DCTERMS}creator`,
445
+ synonyms: [
446
+ "authored by",
447
+ "written by",
448
+ "made by"
449
+ ],
450
+ description: "Who made the subject (a document, a project, a thing).",
451
+ range: PERSON,
452
+ definedBy: DCTERMS
453
+ }),
454
+ entry("part_of", {
455
+ iri: `${DCTERMS}isPartOf`,
456
+ synonyms: ["is part of", "component of"],
457
+ description: "A larger whole the subject is part of.",
458
+ definedBy: DCTERMS
459
+ }),
460
+ entry("depends_on", {
461
+ iri: `${DCTERMS}requires`,
462
+ synonyms: ["requires", "needs"],
463
+ description: "Something the subject cannot work or happen without.",
464
+ definedBy: DCTERMS
465
+ }),
466
+ entry("related_to", {
467
+ iri: `${SKOS}related`,
468
+ synonyms: ["is related to", "is associated with"],
469
+ description: "An associative link when no more specific predicate fits.",
470
+ definedBy: SKOS
471
+ }),
472
+ entry("claim", { description: "A remembered statement about the subject, in the agent’s words." }),
473
+ entry("has_note", {
474
+ label: "has note",
475
+ description: "Notes about the subject, in markdown."
476
+ }),
477
+ entry("helps_with", {
478
+ synonyms: ["will help with", "helping with"],
479
+ description: "Work the subject helps with."
480
+ }),
481
+ entry("works_on", {
482
+ synonyms: ["working on", "will work on"],
483
+ description: "A project or task the subject is working on."
484
+ }),
485
+ entry("uses", {
486
+ synonyms: [
487
+ "is using",
488
+ "built with",
489
+ "adopted",
490
+ "switched to",
491
+ "relies on"
492
+ ],
493
+ description: "A library, tool, language or service the subject uses (a person, a project or a codebase).",
494
+ equivalents: [iriFor("uses", LOCAL_BRAIN)]
495
+ }),
496
+ entry("completed", {
497
+ synonyms: ["finished", "done"],
498
+ description: "A task the subject finished."
499
+ }),
500
+ entry("shipped", {
501
+ synonyms: ["ships", "released"],
502
+ description: "Something the subject released."
503
+ }),
504
+ entry("proposes", {
505
+ synonyms: ["suggests"],
506
+ description: "An idea or change the subject put forward."
507
+ }),
508
+ entry("asked", {
509
+ synonyms: ["asks", "asked question"],
510
+ description: "A question the subject asked: a node typed schema:Question whose `has text` is its wording."
511
+ }),
512
+ entry("received", { description: "Something the subject was sent." }),
513
+ entry("archived", { description: "Something the subject archived." }),
514
+ entry("deleted", { description: "Something the subject deleted." }),
515
+ entry("filed", { description: "Something the subject filed (an issue, a report)." }),
516
+ entry("drafted", { description: "Something the subject drafted." }),
517
+ entry("notified", { description: "Someone the subject notified." }),
518
+ entry("relayed", { description: "A message the subject passed on." }),
519
+ entry("awaiting", {
520
+ synonyms: ["waiting for"],
521
+ description: "Something the subject is waiting for."
522
+ })
523
+ ];
524
+ /** The starter ontology. */
525
+ var DEFAULT = make(DEFAULT_ENTRIES);
526
+ //#endregion
527
+ export { entry as a, key as c, nameFor as d, ontologyQuads as f, Ontology_exports as i, labelFromIri as l, DEFAULT_ENTRIES as n, fromQuads as o, toQuads as p, Ontology as r, iriFor as s, DEFAULT as t, make as u };
528
+
529
+ //# sourceMappingURL=chunk-Ontology.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-Ontology.mjs","names":["Rdf","Predicate.normalize","Vocab.DX","Vocab.LOCAL_BRAIN","Vocab.ONTOLOGY_GRAPH","Vocab.RDF_TYPE","Vocab.RDF_PROPERTY","Vocab.RDFS_LABEL","Vocab.SX_SHORTHAND","Vocab.SKOS_ALT_LABEL","Vocab.RDFS_DOMAIN","Vocab.RDFS_RANGE","Vocab.OWL_INVERSE_OF","Vocab.RDFS_IS_DEFINED_BY","Vocab.DCTERMS_IS_REPLACED_BY","Vocab.OWL_EQUIVALENT_PROPERTY","Vocab.RDFS_COMMENT","Vocab.DCTERMS_CREATED","Vocab.DCTERMS_CREATOR","Vocab.SKOS_EXAMPLE","Vocab.OWL_DEPRECATED","Vocab.XSD","Vocab.SCHEMA","Vocab.RDF","Vocab.RDFS","Vocab.OWL_SAME_AS","Vocab.OWL","Vocab.ORG","Vocab.FOAF","Vocab.DCTERMS","Vocab.SKOS"],"sources":["../../src/Ontology.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Predicate from './Predicate.ts';\nimport * as Rdf from './Rdf.ts';\nimport * as Vocab from './Vocab.ts';\n\nconst { quad, namedNode, literal } = Rdf;\n\n/**\n * A predicate the brain knows: its IRI, the shorthand rules use, the surface forms that map onto it, and the RDFS /\n * OWL / SKOS metadata it is described with in the ontology graph.\n */\nexport type Entry = {\n readonly iri: string;\n /** Lowercase identifier rules may use as shorthand (`works_on(dima, X)`); `sx:shorthand`. */\n readonly name: string;\n /** `rdfs:label`. */\n readonly label: string;\n /** Other surface forms that name it; `skos:altLabel`. */\n readonly synonyms?: ReadonlyArray<string>;\n /** `rdfs:comment`. */\n readonly description?: string;\n /** IRI of the class the subject belongs to; `rdfs:domain`. */\n readonly domain?: string;\n /** IRI of the class the object belongs to; `rdfs:range`. */\n readonly range?: string;\n /** IRI of the predicate that states the same relation in the other direction; `owl:inverseOf`. */\n readonly inverse?: string;\n /**\n * IRIs of predicates that mean the same; `owl:equivalentProperty`. A query for this predicate matches statements\n * made with any of them, which is how predicates are merged without rewriting stored statements.\n */\n readonly equivalents?: ReadonlyArray<string>;\n /** The vocabulary that defines it (`https://schema.org/`, a brain namespace); `rdfs:isDefinedBy`. */\n readonly definedBy?: string;\n /** When an extractor minted it; `dcterms:created`. */\n readonly created?: string;\n /** What minted it (an extractor id and model); `dcterms:creator`. */\n readonly creator?: string;\n /** A quote it was minted from; `skos:example`. */\n readonly example?: string;\n /** The predicate it was merged into; `dcterms:isReplacedBy`, with `owl:deprecated true`. */\n readonly replacedBy?: string;\n};\n\n/**\n * The lookup key for a surface predicate: pipeline-rdf's relation key (case, auxiliaries and head-verb\n * inflection collapse) with words joined by `_`, so `Will-Work-On`, `working on` and `works_on` compare equal.\n */\nexport const key = (surface: string): string => Predicate.normalize(words(surface)).replace(/\\s+/g, '_');\n\n/**\n * The shorthand a surface predicate is minted under: {@link key} without stemming, since the stem is a matching key\n * nobody reads (`changed` keys to `chang`) while the shorthand names the predicate in its IRI and in rules.\n */\nexport const nameFor = (surface: string): string =>\n Predicate.normalize(words(surface), { stem: false }).replace(/\\s+/g, '_');\n\nconst words = (surface: string): string => surface.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/[_-]+/g, ' ');\n\nconst camel = (name: string): string => name.replace(/_([a-z0-9])/g, (_, char: string) => char.toUpperCase());\n\n/** The IRI a predicate shorthand mints to in a namespace, e.g. `works_on` → `dx:worksOn`. */\nexport const iriFor = (name: string, namespace: string = Vocab.DX): string => `${namespace}${camel(name)}`;\n\n/** An entry for a predicate shorthand; the IRI defaults to the `dx:` vocabulary. */\nexport const entry = (\n name: string,\n options: Omit<Entry, 'iri' | 'name' | 'label'> & { iri?: string; label?: string } = {},\n): Entry => ({\n ...options,\n iri: options.iri ?? iriFor(name),\n name,\n label: options.label ?? name.replace(/_/g, ' '),\n definedBy: options.definedBy ?? (options.iri === undefined ? Vocab.DX : undefined),\n});\n\nexport type OntologyOptions = {\n /** Where predicates the ontology does not know are minted: the brain's own namespace. */\n readonly namespace?: string;\n};\n\n/**\n * An extensible set of predicates. A surface form the ontology does not know mints a predicate in the ontology's\n * namespace (its brain's) from its relation key, so two documents that phrase a relation the same way still share\n * one predicate, and a predicate one brain invented never poses as a shared vocabulary term.\n */\nexport class Ontology {\n readonly entries: ReadonlyArray<Entry>;\n readonly namespace: string;\n readonly #byKey = new Map<string, Entry>();\n readonly #byIri = new Map<string, Entry>();\n\n /** @throws Error when two entries claim one surface form or one IRI. */\n constructor(entries: ReadonlyArray<Entry>, { namespace = Vocab.LOCAL_BRAIN }: OntologyOptions = {}) {\n this.entries = entries;\n this.namespace = namespace;\n for (const entry of entries) {\n if (this.#byIri.has(entry.iri)) {\n throw new Error(`Predicate defined twice: ${entry.iri}`);\n }\n this.#byIri.set(entry.iri, entry);\n }\n // Equivalents resolve to the entry naming them, unless an entry of their own defines them.\n for (const entry of entries) {\n for (const equivalent of entry.equivalents ?? []) {\n if (!this.#byIri.has(equivalent)) {\n this.#byIri.set(equivalent, entry);\n }\n }\n }\n for (const entry of entries) {\n // A merged-away predicate keeps its IRI readable but no longer claims surface forms.\n if (entry.replacedBy !== undefined) {\n continue;\n }\n for (const surface of [entry.name, entry.label, ...(entry.synonyms ?? [])]) {\n const existing = this.#byKey.get(key(surface));\n if (existing !== undefined && existing.iri !== entry.iri) {\n throw new Error(`Synonym ${surface} maps to both ${existing.name} and ${entry.name}`);\n }\n this.#byKey.set(key(surface), entry);\n }\n }\n }\n\n /** The entry a surface form names, if the ontology knows it. */\n find(surface: string): Entry | undefined {\n return this.#byKey.get(key(surface));\n }\n\n /** The entry for an IRI (its own, or one it is equivalent to), if the ontology defines it. */\n get(iri: string): Entry | undefined {\n return this.#byIri.get(iri);\n }\n\n /** The entry an IRI stands for: a merged-away predicate's survivor, else its own entry. */\n canonical(iri: string): Entry | undefined {\n let entry = this.get(iri);\n const seen = new Set<string>();\n while (entry?.replacedBy !== undefined && !seen.has(entry.iri)) {\n seen.add(entry.iri);\n entry = this.get(entry.replacedBy) ?? entry;\n }\n return entry;\n }\n\n /** The IRIs a query for this predicate matches: its own and every equivalent, either way round. */\n equivalents(iri: string): Set<string> {\n const entry = this.canonical(iri);\n const iris = new Set([iri]);\n if (entry) {\n iris.add(entry.iri);\n for (const equivalent of entry.equivalents ?? []) {\n iris.add(equivalent);\n }\n for (const other of this.entries) {\n if (other.replacedBy === entry.iri) {\n iris.add(other.iri);\n }\n }\n }\n return iris;\n }\n\n /** The entry for a surface form; one the ontology does not know is minted in its namespace, labelled with the form. */\n resolve(surface: string): Entry {\n const known = this.find(surface);\n if (known) {\n return known;\n }\n const name = nameFor(surface);\n return { iri: iriFor(name, this.namespace), name, label: surface.trim(), definedBy: this.namespace };\n }\n\n /** A new ontology with these entries added; an entry for a known IRI replaces it. */\n extend(entries: ReadonlyArray<Entry>): Ontology {\n const iris = new Set(entries.map(({ iri }) => iri));\n return new Ontology([...this.entries.filter(({ iri }) => !iris.has(iri)), ...entries], {\n namespace: this.namespace,\n });\n }\n\n /**\n * A new ontology with the predicates a brain has learned added: unlike {@link extend}, an entry this ontology\n * already defines, or whose surface form it already maps, is skipped rather than rejected, since a store may hold\n * predicates minted before the seed vocabulary named them.\n */\n include(entries: ReadonlyArray<Entry>): Ontology {\n const learned: Entry[] = [];\n const surfaces = new Set<string>();\n for (const entry of entries) {\n const forms = [entry.name, entry.label, ...(entry.synonyms ?? [])].map(key);\n if (this.get(entry.iri) || forms.some((form) => this.#byKey.has(form) || surfaces.has(form))) {\n continue;\n }\n forms.forEach((form) => surfaces.add(form));\n learned.push(entry);\n }\n return learned.length === 0 ? this : this.extend(learned);\n }\n\n /** The same predicates, minting new ones in another namespace. */\n withNamespace(namespace: string): Ontology {\n return new Ontology(this.entries, { namespace });\n }\n\n /**\n * Merges one predicate into another: the survivor gains the other's IRI as an equivalent and its surface forms as\n * synonyms, and the other is kept, deprecated, so stored statements made with it still read and match.\n * @throws Error when either IRI is not an entry of this ontology.\n */\n merge(from: string, into: string): Ontology {\n const source = this.entries.find(({ iri }) => iri === from);\n const target = this.entries.find(({ iri }) => iri === into);\n if (!source || !target) {\n throw new Error(`Cannot merge ${from} into ${into}: both must be defined.`);\n }\n const forms = new Set([target.name, target.label, ...(target.synonyms ?? [])].map(key));\n const merged: Entry = {\n ...target,\n synonyms: [\n ...(target.synonyms ?? []),\n ...[source.name, source.label, ...(source.synonyms ?? [])].filter((form) => !forms.has(key(form))),\n ].filter((form, index, all) => all.findIndex((other) => key(other) === key(form)) === index),\n equivalents: [...new Set([...(target.equivalents ?? []), source.iri, ...(source.equivalents ?? [])])],\n };\n const deprecated: Entry = { ...source, synonyms: [], equivalents: [], replacedBy: into };\n return new Ontology(\n this.entries.map((entry) => (entry.iri === into ? merged : entry.iri === from ? deprecated : entry)),\n { namespace: this.namespace },\n );\n }\n}\n\n/** Creates an ontology. */\nexport const make = (entries: ReadonlyArray<Entry>, options?: OntologyOptions): Ontology =>\n new Ontology(entries, options);\n\n/** The label an IRI reads as when no ontology defines it: its local name, split into words. */\nexport const labelFromIri = (iri: string): string =>\n iri\n .replace(/^.*[#/]/, '')\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .toLowerCase();\n\n//\n// The ontology graph: every predicate is an `rdf:Property` described with RDFS, OWL, SKOS and DCMI terms, in a\n// graph of its own (`Vocab.ONTOLOGY_GRAPH`) so the vocabulary is never mixed into the statements that use it.\n//\n\nconst ontologyGraph = () => namedNode(Vocab.ONTOLOGY_GRAPH);\n\n/** The entry as quads in the ontology graph. */\nexport const toQuads = (entry: Entry): Rdf.Quad[] => {\n const subject = namedNode(entry.iri);\n const quads: Rdf.Quad[] = [];\n const add = (predicate: string, object: Rdf.NamedNode | Rdf.Literal) =>\n quads.push(quad(subject, namedNode(predicate), object, ontologyGraph()));\n add(Vocab.RDF_TYPE, namedNode(Vocab.RDF_PROPERTY));\n add(Vocab.RDFS_LABEL, literal(entry.label));\n add(Vocab.SX_SHORTHAND, literal(entry.name));\n for (const synonym of entry.synonyms ?? []) {\n add(Vocab.SKOS_ALT_LABEL, literal(synonym));\n }\n const iris: ReadonlyArray<[string, string | undefined]> = [\n [Vocab.RDFS_DOMAIN, entry.domain],\n [Vocab.RDFS_RANGE, entry.range],\n [Vocab.OWL_INVERSE_OF, entry.inverse],\n [Vocab.RDFS_IS_DEFINED_BY, entry.definedBy],\n [Vocab.DCTERMS_IS_REPLACED_BY, entry.replacedBy],\n ];\n for (const [predicate, value] of iris) {\n if (value !== undefined) {\n add(predicate, namedNode(value));\n }\n }\n for (const equivalent of entry.equivalents ?? []) {\n add(Vocab.OWL_EQUIVALENT_PROPERTY, namedNode(equivalent));\n }\n const literals: ReadonlyArray<[string, string | undefined]> = [\n [Vocab.RDFS_COMMENT, entry.description],\n [Vocab.DCTERMS_CREATED, entry.created],\n [Vocab.DCTERMS_CREATOR, entry.creator],\n [Vocab.SKOS_EXAMPLE, entry.example],\n ];\n for (const [predicate, value] of literals) {\n if (value !== undefined) {\n add(predicate, literal(value));\n }\n }\n if (entry.replacedBy !== undefined) {\n add(Vocab.OWL_DEPRECATED, literal('true', namedNode(`${Vocab.XSD}boolean`)));\n }\n return quads;\n};\n\n/**\n * The entries described in the ontology graph, one per subject; the inverse of {@link toQuads}. A predicate known\n * only by its label (as facts store a minted one) reads with the shorthand its label keys to. Multi-valued fields\n * keep their first value where an entry holds one value.\n */\nexport const fromQuads = (quads: readonly Rdf.Quad[]): Entry[] => {\n const subjects = new Map<string, Map<string, string[]>>();\n for (const entry of quads) {\n if (entry.graph.value !== Vocab.ONTOLOGY_GRAPH || entry.subject.termType !== 'NamedNode') {\n continue;\n }\n let props = subjects.get(entry.subject.value);\n if (!props) {\n subjects.set(entry.subject.value, (props = new Map()));\n }\n const values = props.get(entry.predicate.value) ?? [];\n if (!values.includes(entry.object.value)) {\n props.set(entry.predicate.value, [...values, entry.object.value]);\n }\n }\n return [...subjects].flatMap(([iri, props]) => {\n const one = (predicate: string) => props.get(predicate)?.[0];\n const many = (predicate: string) => props.get(predicate) ?? [];\n const label = one(Vocab.RDFS_LABEL) ?? labelFromIri(iri);\n const optional = {\n synonyms: many(Vocab.SKOS_ALT_LABEL),\n equivalents: many(Vocab.OWL_EQUIVALENT_PROPERTY),\n description: one(Vocab.RDFS_COMMENT),\n domain: one(Vocab.RDFS_DOMAIN),\n range: one(Vocab.RDFS_RANGE),\n inverse: one(Vocab.OWL_INVERSE_OF),\n definedBy: one(Vocab.RDFS_IS_DEFINED_BY),\n created: one(Vocab.DCTERMS_CREATED),\n creator: one(Vocab.DCTERMS_CREATOR),\n example: one(Vocab.SKOS_EXAMPLE),\n replacedBy: one(Vocab.DCTERMS_IS_REPLACED_BY),\n };\n return [\n {\n iri,\n name: one(Vocab.SX_SHORTHAND) ?? nameFor(label),\n label,\n ...Object.fromEntries(\n Object.entries(optional).filter(([, value]) =>\n Array.isArray(value) ? value.length > 0 : value !== undefined,\n ),\n ),\n },\n ];\n });\n};\n\n/** Every entry of the ontology as quads in the ontology graph. */\nexport const ontologyQuads = (ontology: Ontology): Rdf.Quad[] => ontology.entries.flatMap(toQuads);\n\n//\n// The seed vocabulary. A predicate an established vocabulary defines is used under that vocabulary's own IRI, so\n// the brain's graph reads as schema.org / FOAF / Dublin Core to any RDF tool; `dx:` holds only the relations no\n// such vocabulary has (an agent's memories and actions). Each seed lists the `dx:` IRI it was stored under before\n// it moved to the external one as an equivalent, so earlier statements still match.\n//\n\nconst schema = (name: string) => `${Vocab.SCHEMA}${name}`;\nconst dx = (name: string) => `${Vocab.DX}${name}`;\n\nconst PERSON = schema('Person');\nconst ORGANIZATION = schema('Organization');\nconst PLACE = schema('Place');\n\n/** The starter predicates: people and organizations, plus the relations agent goals are written against. */\nexport const DEFAULT_ENTRIES: ReadonlyArray<Entry> = [\n // RDF / RDFS: class membership.\n entry('is_a', {\n iri: Vocab.RDF_TYPE,\n label: 'is a',\n synonyms: ['is an', 'is instance of'],\n description: 'A class the subject is an instance of: \"Socrates is a man\".',\n definedBy: Vocab.RDF,\n equivalents: [dx('isA')],\n }),\n entry('kind_of', {\n iri: `${Vocab.RDFS}subClassOf`,\n label: 'kind of',\n synonyms: ['is kind of', 'is type of', 'is a type of', 'subclass of'],\n description:\n 'A broader class every instance of the subject class belongs to: \"a philosopher is a kind of thinker\".',\n definedBy: Vocab.RDFS,\n }),\n entry('same_as', {\n iri: Vocab.OWL_SAME_AS,\n label: 'same as',\n synonyms: ['also known as', 'aka', 'is the same as'],\n description: 'The subject and object are one and the same entity.',\n definedBy: Vocab.OWL,\n }),\n\n // schema.org: people and organizations.\n entry('has_role', {\n iri: schema('jobTitle'),\n label: 'has role',\n synonyms: ['works as', 'is on the team as', 'role', 'job title'],\n description: 'The role or job title the subject holds.',\n domain: PERSON,\n definedBy: Vocab.SCHEMA,\n equivalents: [dx('hasRole')],\n }),\n entry('member_of', {\n iri: schema('memberOf'),\n synonyms: ['belongs to', 'is member of', 'is on the team', 'is on team'],\n description: 'The organization or team the subject belongs to.',\n domain: PERSON,\n range: ORGANIZATION,\n inverse: schema('member'),\n definedBy: Vocab.SCHEMA,\n equivalents: [dx('memberOf'), `${Vocab.ORG}memberOf`],\n }),\n entry('has_member', {\n iri: schema('member'),\n description: 'A member of the organization or team.',\n domain: ORGANIZATION,\n range: PERSON,\n inverse: schema('memberOf'),\n definedBy: Vocab.SCHEMA,\n equivalents: [dx('hasMember'), `${Vocab.ORG}hasMember`],\n }),\n entry('works_for', {\n iri: schema('worksFor'),\n synonyms: ['works at', 'employed by', 'is employed at'],\n description: 'The organization that employs the subject.',\n domain: PERSON,\n range: ORGANIZATION,\n definedBy: Vocab.SCHEMA,\n }),\n entry('founded', {\n synonyms: ['is founder of', 'established', 'started'],\n description: 'An organization the subject founded; schema.org states it the other way round (`schema:founder`).',\n domain: PERSON,\n range: ORGANIZATION,\n inverse: schema('founder'),\n }),\n entry('alumni_of', {\n iri: schema('alumniOf'),\n label: 'alumni of',\n synonyms: ['studied at', 'graduated from'],\n description: 'A school or organization (never a person) the subject studied at or was formerly part of.',\n domain: PERSON,\n range: ORGANIZATION,\n definedBy: Vocab.SCHEMA,\n }),\n entry('knows_about', {\n iri: schema('knowsAbout'),\n synonyms: ['is expert in', 'is the one to ask about', 'expert in', 'specializes in'],\n description: 'An area the subject can answer questions about.',\n definedBy: Vocab.SCHEMA,\n equivalents: [dx('knowsAbout')],\n }),\n entry('located_in', {\n iri: schema('location'),\n synonyms: ['lives in', 'is based in', 'based in', 'is located in'],\n description: 'Where the subject is.',\n range: PLACE,\n definedBy: Vocab.SCHEMA,\n equivalents: [dx('locatedIn')],\n }),\n entry('born_in', {\n iri: schema('birthPlace'),\n synonyms: ['was born in', 'birthplace'],\n description: 'The place the subject was born.',\n domain: PERSON,\n range: PLACE,\n definedBy: Vocab.SCHEMA,\n }),\n entry('about', {\n iri: schema('about'),\n synonyms: ['is about', 'concerns', 'covers'],\n description: 'The topic a document, message or event is about.',\n definedBy: Vocab.SCHEMA,\n }),\n entry('mentions', {\n iri: schema('mentions'),\n synonyms: ['refers to', 'cites'],\n description: 'An entity a document or message mentions without being about it.',\n definedBy: Vocab.SCHEMA,\n }),\n entry('text', {\n iri: schema('text'),\n label: 'has text',\n synonyms: ['wording'],\n description: 'The wording of a message, question or document.',\n definedBy: Vocab.SCHEMA,\n }),\n\n // FOAF: social relations and accounts.\n entry('knows', {\n iri: `${Vocab.FOAF}knows`,\n synonyms: ['is friends with', 'is acquainted with', 'met'],\n description: 'A person the subject knows.',\n domain: PERSON,\n range: PERSON,\n definedBy: Vocab.FOAF,\n equivalents: [schema('knows')],\n }),\n entry('has_account', {\n iri: `${Vocab.FOAF}account`,\n synonyms: ['is on discord as', 'username', 'handle'],\n description: 'An account the subject uses, such as a Discord username.',\n definedBy: Vocab.FOAF,\n equivalents: [dx('hasAccount')],\n }),\n\n // Dublin Core: works and their parts.\n entry('created_by', {\n iri: `${Vocab.DCTERMS}creator`,\n synonyms: ['authored by', 'written by', 'made by'],\n description: 'Who made the subject (a document, a project, a thing).',\n range: PERSON,\n definedBy: Vocab.DCTERMS,\n }),\n entry('part_of', {\n iri: `${Vocab.DCTERMS}isPartOf`,\n synonyms: ['is part of', 'component of'],\n description: 'A larger whole the subject is part of.',\n definedBy: Vocab.DCTERMS,\n }),\n entry('depends_on', {\n iri: `${Vocab.DCTERMS}requires`,\n synonyms: ['requires', 'needs'],\n description: 'Something the subject cannot work or happen without.',\n definedBy: Vocab.DCTERMS,\n }),\n entry('related_to', {\n iri: `${Vocab.SKOS}related`,\n synonyms: ['is related to', 'is associated with'],\n description: 'An associative link when no more specific predicate fits.',\n definedBy: Vocab.SKOS,\n }),\n\n // dx: what an agent records and does, which no shared vocabulary names.\n entry('claim', { description: 'A remembered statement about the subject, in the agent’s words.' }),\n entry('has_note', { label: 'has note', description: 'Notes about the subject, in markdown.' }),\n entry('helps_with', { synonyms: ['will help with', 'helping with'], description: 'Work the subject helps with.' }),\n entry('works_on', {\n synonyms: ['working on', 'will work on'],\n description: 'A project or task the subject is working on.',\n }),\n entry('uses', {\n synonyms: ['is using', 'built with', 'adopted', 'switched to', 'relies on'],\n description: 'A library, tool, language or service the subject uses (a person, a project or a codebase).',\n // Extractors minted it in the local brain before it was seeded; the equivalence keeps those statements matching.\n equivalents: [iriFor('uses', Vocab.LOCAL_BRAIN)],\n }),\n entry('completed', { synonyms: ['finished', 'done'], description: 'A task the subject finished.' }),\n entry('shipped', { synonyms: ['ships', 'released'], description: 'Something the subject released.' }),\n entry('proposes', { synonyms: ['suggests'], description: 'An idea or change the subject put forward.' }),\n entry('asked', {\n synonyms: ['asks', 'asked question'],\n description: 'A question the subject asked: a node typed schema:Question whose `has text` is its wording.',\n }),\n entry('received', { description: 'Something the subject was sent.' }),\n entry('archived', { description: 'Something the subject archived.' }),\n entry('deleted', { description: 'Something the subject deleted.' }),\n entry('filed', { description: 'Something the subject filed (an issue, a report).' }),\n entry('drafted', { description: 'Something the subject drafted.' }),\n entry('notified', { description: 'Someone the subject notified.' }),\n entry('relayed', { description: 'A message the subject passed on.' }),\n entry('awaiting', { synonyms: ['waiting for'], description: 'Something the subject is waiting for.' }),\n];\n\n/** The starter ontology. */\nexport const DEFAULT: Ontology = make(DEFAULT_ENTRIES);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA,IAAM,EAAE,MAAM,WAAW,YAAYA;;;;;AA2CrC,IAAa,OAAO,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