@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.
- package/LICENSE +105 -0
- package/dist/lib/Fact.mjs +1 -0
- package/dist/lib/FactFeed.mjs +1 -0
- package/dist/lib/Graph.mjs +1 -0
- package/dist/lib/Hash.mjs +1 -0
- package/dist/lib/Mapping.mjs +1 -0
- package/dist/lib/MemoryError.mjs +1 -0
- package/dist/lib/MemoryQuery.mjs +1 -0
- package/dist/lib/MemoryService.mjs +1 -0
- package/dist/lib/Ontology.mjs +1 -0
- package/dist/lib/Pipeline.mjs +1 -0
- package/dist/lib/Predicate.mjs +1 -0
- package/dist/lib/Rdf.mjs +1 -0
- package/dist/lib/RdfStore.mjs +1 -0
- package/dist/lib/Sparql.mjs +1 -0
- package/dist/lib/Subscription.mjs +1 -0
- package/dist/lib/Trig.mjs +1 -0
- package/dist/lib/Vocab.mjs +1 -0
- package/dist/lib/Vocabularies.mjs +1 -0
- package/dist/lib/chunk-Fact.mjs +245 -0
- package/dist/lib/chunk-Fact.mjs.map +1 -0
- package/dist/lib/chunk-FactFeed.mjs +29 -0
- package/dist/lib/chunk-FactFeed.mjs.map +1 -0
- package/dist/lib/chunk-Graph.mjs +147 -0
- package/dist/lib/chunk-Graph.mjs.map +1 -0
- package/dist/lib/chunk-Hash.mjs +16 -0
- package/dist/lib/chunk-Hash.mjs.map +1 -0
- package/dist/lib/chunk-Mapping.mjs +226 -0
- package/dist/lib/chunk-Mapping.mjs.map +1 -0
- package/dist/lib/chunk-MemoryError.mjs +10 -0
- package/dist/lib/chunk-MemoryError.mjs.map +1 -0
- package/dist/lib/chunk-MemoryQuery.mjs +99 -0
- package/dist/lib/chunk-MemoryQuery.mjs.map +1 -0
- package/dist/lib/chunk-MemoryService.mjs +31 -0
- package/dist/lib/chunk-MemoryService.mjs.map +1 -0
- package/dist/lib/chunk-Ontology.mjs +529 -0
- package/dist/lib/chunk-Ontology.mjs.map +1 -0
- package/dist/lib/chunk-Pipeline.mjs +84 -0
- package/dist/lib/chunk-Pipeline.mjs.map +1 -0
- package/dist/lib/chunk-Predicate.mjs +66 -0
- package/dist/lib/chunk-Predicate.mjs.map +1 -0
- package/dist/lib/chunk-Rdf.mjs +120 -0
- package/dist/lib/chunk-Rdf.mjs.map +1 -0
- package/dist/lib/chunk-RdfStore.mjs +60 -0
- package/dist/lib/chunk-RdfStore.mjs.map +1 -0
- package/dist/lib/chunk-Sparql.mjs +153 -0
- package/dist/lib/chunk-Sparql.mjs.map +1 -0
- package/dist/lib/chunk-Subscription.mjs +44 -0
- package/dist/lib/chunk-Subscription.mjs.map +1 -0
- package/dist/lib/chunk-Trig.mjs +106 -0
- package/dist/lib/chunk-Trig.mjs.map +1 -0
- package/dist/lib/chunk-Vocab.mjs +164 -0
- package/dist/lib/chunk-Vocab.mjs.map +1 -0
- package/dist/lib/chunk-Vocabularies.mjs +343 -0
- package/dist/lib/chunk-Vocabularies.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/index.mjs +19 -0
- package/dist/types/src/Fact.d.ts +339 -0
- package/dist/types/src/Fact.d.ts.map +1 -0
- package/dist/types/src/Fact.test.d.ts +2 -0
- package/dist/types/src/Fact.test.d.ts.map +1 -0
- package/dist/types/src/FactFeed.d.ts +11 -0
- package/dist/types/src/FactFeed.d.ts.map +1 -0
- package/dist/types/src/FactFeed.test.d.ts +2 -0
- package/dist/types/src/FactFeed.test.d.ts.map +1 -0
- package/dist/types/src/Graph.d.ts +31 -0
- package/dist/types/src/Graph.d.ts.map +1 -0
- package/dist/types/src/Graph.test.d.ts +2 -0
- package/dist/types/src/Graph.test.d.ts.map +1 -0
- package/dist/types/src/Hash.d.ts +3 -0
- package/dist/types/src/Hash.d.ts.map +1 -0
- package/dist/types/src/Mapping.d.ts +18 -0
- package/dist/types/src/Mapping.d.ts.map +1 -0
- package/dist/types/src/Mapping.test.d.ts +2 -0
- package/dist/types/src/Mapping.test.d.ts.map +1 -0
- package/dist/types/src/MemoryError.d.ts +33 -0
- package/dist/types/src/MemoryError.d.ts.map +1 -0
- package/dist/types/src/MemoryQuery.d.ts +136 -0
- package/dist/types/src/MemoryQuery.d.ts.map +1 -0
- package/dist/types/src/MemoryQuery.test.d.ts +2 -0
- package/dist/types/src/MemoryQuery.test.d.ts.map +1 -0
- package/dist/types/src/MemoryService.d.ts +72 -0
- package/dist/types/src/MemoryService.d.ts.map +1 -0
- package/dist/types/src/Ontology.d.ts +115 -0
- package/dist/types/src/Ontology.d.ts.map +1 -0
- package/dist/types/src/Ontology.test.d.ts +2 -0
- package/dist/types/src/Ontology.test.d.ts.map +1 -0
- package/dist/types/src/Pipeline.d.ts +103 -0
- package/dist/types/src/Pipeline.d.ts.map +1 -0
- package/dist/types/src/Predicate.d.ts +17 -0
- package/dist/types/src/Predicate.d.ts.map +1 -0
- package/dist/types/src/Predicate.test.d.ts +2 -0
- package/dist/types/src/Predicate.test.d.ts.map +1 -0
- package/dist/types/src/Rdf.d.ts +33 -0
- package/dist/types/src/Rdf.d.ts.map +1 -0
- package/dist/types/src/Rdf.test.d.ts +2 -0
- package/dist/types/src/Rdf.test.d.ts.map +1 -0
- package/dist/types/src/RdfStore.d.ts +471 -0
- package/dist/types/src/RdfStore.d.ts.map +1 -0
- package/dist/types/src/Sparql.d.ts +58 -0
- package/dist/types/src/Sparql.d.ts.map +1 -0
- package/dist/types/src/Sparql.test.d.ts +2 -0
- package/dist/types/src/Sparql.test.d.ts.map +1 -0
- package/dist/types/src/Subscription.d.ts +100 -0
- package/dist/types/src/Subscription.d.ts.map +1 -0
- package/dist/types/src/Trig.d.ts +8 -0
- package/dist/types/src/Trig.d.ts.map +1 -0
- package/dist/types/src/Trig.test.d.ts +2 -0
- package/dist/types/src/Trig.test.d.ts.map +1 -0
- package/dist/types/src/Vocab.d.ts +90 -0
- package/dist/types/src/Vocab.d.ts.map +1 -0
- package/dist/types/src/Vocabularies.d.ts +45 -0
- package/dist/types/src/Vocabularies.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +19 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +133 -3
- package/src/Fact.test.ts +74 -0
- package/src/Fact.ts +269 -0
- package/src/FactFeed.test.ts +40 -0
- package/src/FactFeed.ts +38 -0
- package/src/Graph.test.ts +106 -0
- package/src/Graph.ts +158 -0
- package/src/Hash.ts +15 -0
- package/src/Mapping.test.ts +197 -0
- package/src/Mapping.ts +320 -0
- package/src/MemoryError.ts +10 -0
- package/src/MemoryQuery.test.ts +67 -0
- package/src/MemoryQuery.ts +114 -0
- package/src/MemoryService.ts +89 -0
- package/src/Ontology.test.ts +94 -0
- package/src/Ontology.ts +571 -0
- package/src/Pipeline.ts +97 -0
- package/src/Predicate.test.ts +47 -0
- package/src/Predicate.ts +89 -0
- package/src/Rdf.test.ts +104 -0
- package/src/Rdf.ts +158 -0
- package/src/RdfStore.ts +111 -0
- package/src/Sparql.test.ts +72 -0
- package/src/Sparql.ts +237 -0
- package/src/Subscription.ts +47 -0
- package/src/Trig.test.ts +199 -0
- package/src/Trig.ts +170 -0
- package/src/Vocab.ts +134 -0
- package/src/Vocabularies.ts +204 -0
- package/src/index.ts +22 -0
- package/README.md +0 -3
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
import * as Context from 'effect/Context';
|
|
2
|
+
import type * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
import type * as Scope from 'effect/Scope';
|
|
5
|
+
import { BaseError } from '@dxos/errors';
|
|
6
|
+
import * as MemoryQuery from './MemoryQuery.ts';
|
|
7
|
+
/** A triple in the default graph, or a quad in the named graph `g`. */
|
|
8
|
+
export declare const Quad: Schema.Struct<{
|
|
9
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
10
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
11
|
+
readonly value: Schema.String;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
14
|
+
readonly value: Schema.String;
|
|
15
|
+
}>, Schema.Struct<{
|
|
16
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
17
|
+
readonly value: Schema.String;
|
|
18
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
19
|
+
readonly language: Schema.optional<Schema.String>;
|
|
20
|
+
}>]>;
|
|
21
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
22
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
23
|
+
readonly value: Schema.String;
|
|
24
|
+
}>, Schema.Struct<{
|
|
25
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
26
|
+
readonly value: Schema.String;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
29
|
+
readonly value: Schema.String;
|
|
30
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
31
|
+
readonly language: Schema.optional<Schema.String>;
|
|
32
|
+
}>]>;
|
|
33
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
34
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
35
|
+
readonly value: Schema.String;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
38
|
+
readonly value: Schema.String;
|
|
39
|
+
}>, Schema.Struct<{
|
|
40
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
41
|
+
readonly value: Schema.String;
|
|
42
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
43
|
+
readonly language: Schema.optional<Schema.String>;
|
|
44
|
+
}>]>;
|
|
45
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
46
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
47
|
+
readonly value: Schema.String;
|
|
48
|
+
}>, Schema.Struct<{
|
|
49
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
50
|
+
readonly value: Schema.String;
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
53
|
+
readonly value: Schema.String;
|
|
54
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
55
|
+
readonly language: Schema.optional<Schema.String>;
|
|
56
|
+
}>]>>;
|
|
57
|
+
}>;
|
|
58
|
+
export interface Quad extends Schema.Schema.Type<typeof Quad> {
|
|
59
|
+
}
|
|
60
|
+
/** Adds quads; one already stored is kept once. */
|
|
61
|
+
export declare const Insert: Schema.TaggedStruct<"insert", {
|
|
62
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
63
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
64
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
65
|
+
readonly value: Schema.String;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
68
|
+
readonly value: Schema.String;
|
|
69
|
+
}>, Schema.Struct<{
|
|
70
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
71
|
+
readonly value: Schema.String;
|
|
72
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
73
|
+
readonly language: Schema.optional<Schema.String>;
|
|
74
|
+
}>]>;
|
|
75
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
76
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
77
|
+
readonly value: Schema.String;
|
|
78
|
+
}>, Schema.Struct<{
|
|
79
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
80
|
+
readonly value: Schema.String;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
83
|
+
readonly value: Schema.String;
|
|
84
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
85
|
+
readonly language: Schema.optional<Schema.String>;
|
|
86
|
+
}>]>;
|
|
87
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
88
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
89
|
+
readonly value: Schema.String;
|
|
90
|
+
}>, Schema.Struct<{
|
|
91
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
92
|
+
readonly value: Schema.String;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
95
|
+
readonly value: Schema.String;
|
|
96
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
97
|
+
readonly language: Schema.optional<Schema.String>;
|
|
98
|
+
}>]>;
|
|
99
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
100
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
101
|
+
readonly value: Schema.String;
|
|
102
|
+
}>, Schema.Struct<{
|
|
103
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
104
|
+
readonly value: Schema.String;
|
|
105
|
+
}>, Schema.Struct<{
|
|
106
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
107
|
+
readonly value: Schema.String;
|
|
108
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
109
|
+
readonly language: Schema.optional<Schema.String>;
|
|
110
|
+
}>]>>;
|
|
111
|
+
}>>;
|
|
112
|
+
}>;
|
|
113
|
+
export interface Insert extends Schema.Schema.Type<typeof Insert> {
|
|
114
|
+
}
|
|
115
|
+
/** Removes quads; one not stored is ignored. */
|
|
116
|
+
export declare const Delete: Schema.TaggedStruct<"delete", {
|
|
117
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
118
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
119
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
120
|
+
readonly value: Schema.String;
|
|
121
|
+
}>, Schema.Struct<{
|
|
122
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
123
|
+
readonly value: Schema.String;
|
|
124
|
+
}>, Schema.Struct<{
|
|
125
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
126
|
+
readonly value: Schema.String;
|
|
127
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
128
|
+
readonly language: Schema.optional<Schema.String>;
|
|
129
|
+
}>]>;
|
|
130
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
131
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
132
|
+
readonly value: Schema.String;
|
|
133
|
+
}>, Schema.Struct<{
|
|
134
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
135
|
+
readonly value: Schema.String;
|
|
136
|
+
}>, Schema.Struct<{
|
|
137
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
138
|
+
readonly value: Schema.String;
|
|
139
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
140
|
+
readonly language: Schema.optional<Schema.String>;
|
|
141
|
+
}>]>;
|
|
142
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
143
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
144
|
+
readonly value: Schema.String;
|
|
145
|
+
}>, Schema.Struct<{
|
|
146
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
147
|
+
readonly value: Schema.String;
|
|
148
|
+
}>, Schema.Struct<{
|
|
149
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
150
|
+
readonly value: Schema.String;
|
|
151
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
152
|
+
readonly language: Schema.optional<Schema.String>;
|
|
153
|
+
}>]>;
|
|
154
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
155
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
156
|
+
readonly value: Schema.String;
|
|
157
|
+
}>, Schema.Struct<{
|
|
158
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
159
|
+
readonly value: Schema.String;
|
|
160
|
+
}>, Schema.Struct<{
|
|
161
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
162
|
+
readonly value: Schema.String;
|
|
163
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
164
|
+
readonly language: Schema.optional<Schema.String>;
|
|
165
|
+
}>]>>;
|
|
166
|
+
}>>;
|
|
167
|
+
}>;
|
|
168
|
+
export interface Delete extends Schema.Schema.Type<typeof Delete> {
|
|
169
|
+
}
|
|
170
|
+
/** Removes every quad of the part written to. */
|
|
171
|
+
export declare const Clear: Schema.TaggedStruct<"clear", {}>;
|
|
172
|
+
export interface Clear extends Schema.Schema.Type<typeof Clear> {
|
|
173
|
+
}
|
|
174
|
+
/** One change to the store. */
|
|
175
|
+
export declare const Write: Schema.Union<readonly [Schema.TaggedStruct<"insert", {
|
|
176
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
177
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
178
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
179
|
+
readonly value: Schema.String;
|
|
180
|
+
}>, Schema.Struct<{
|
|
181
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
182
|
+
readonly value: Schema.String;
|
|
183
|
+
}>, Schema.Struct<{
|
|
184
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
185
|
+
readonly value: Schema.String;
|
|
186
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
187
|
+
readonly language: Schema.optional<Schema.String>;
|
|
188
|
+
}>]>;
|
|
189
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
190
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
191
|
+
readonly value: Schema.String;
|
|
192
|
+
}>, Schema.Struct<{
|
|
193
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
194
|
+
readonly value: Schema.String;
|
|
195
|
+
}>, Schema.Struct<{
|
|
196
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
197
|
+
readonly value: Schema.String;
|
|
198
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
199
|
+
readonly language: Schema.optional<Schema.String>;
|
|
200
|
+
}>]>;
|
|
201
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
202
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
203
|
+
readonly value: Schema.String;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
206
|
+
readonly value: Schema.String;
|
|
207
|
+
}>, Schema.Struct<{
|
|
208
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
209
|
+
readonly value: Schema.String;
|
|
210
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
211
|
+
readonly language: Schema.optional<Schema.String>;
|
|
212
|
+
}>]>;
|
|
213
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
214
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
215
|
+
readonly value: Schema.String;
|
|
216
|
+
}>, Schema.Struct<{
|
|
217
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
218
|
+
readonly value: Schema.String;
|
|
219
|
+
}>, Schema.Struct<{
|
|
220
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
221
|
+
readonly value: Schema.String;
|
|
222
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
223
|
+
readonly language: Schema.optional<Schema.String>;
|
|
224
|
+
}>]>>;
|
|
225
|
+
}>>;
|
|
226
|
+
}>, Schema.TaggedStruct<"delete", {
|
|
227
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
228
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
229
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
230
|
+
readonly value: Schema.String;
|
|
231
|
+
}>, Schema.Struct<{
|
|
232
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
233
|
+
readonly value: Schema.String;
|
|
234
|
+
}>, Schema.Struct<{
|
|
235
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
236
|
+
readonly value: Schema.String;
|
|
237
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
238
|
+
readonly language: Schema.optional<Schema.String>;
|
|
239
|
+
}>]>;
|
|
240
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
241
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
242
|
+
readonly value: Schema.String;
|
|
243
|
+
}>, Schema.Struct<{
|
|
244
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
245
|
+
readonly value: Schema.String;
|
|
246
|
+
}>, Schema.Struct<{
|
|
247
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
248
|
+
readonly value: Schema.String;
|
|
249
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
250
|
+
readonly language: Schema.optional<Schema.String>;
|
|
251
|
+
}>]>;
|
|
252
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
253
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
254
|
+
readonly value: Schema.String;
|
|
255
|
+
}>, Schema.Struct<{
|
|
256
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
257
|
+
readonly value: Schema.String;
|
|
258
|
+
}>, Schema.Struct<{
|
|
259
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
260
|
+
readonly value: Schema.String;
|
|
261
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
262
|
+
readonly language: Schema.optional<Schema.String>;
|
|
263
|
+
}>]>;
|
|
264
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
265
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
266
|
+
readonly value: Schema.String;
|
|
267
|
+
}>, Schema.Struct<{
|
|
268
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
269
|
+
readonly value: Schema.String;
|
|
270
|
+
}>, Schema.Struct<{
|
|
271
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
272
|
+
readonly value: Schema.String;
|
|
273
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
274
|
+
readonly language: Schema.optional<Schema.String>;
|
|
275
|
+
}>]>>;
|
|
276
|
+
}>>;
|
|
277
|
+
}>, Schema.TaggedStruct<"clear", {}>]>;
|
|
278
|
+
export type Write = Schema.Schema.Type<typeof Write>;
|
|
279
|
+
/** Writes recorded together and applied together, in order. */
|
|
280
|
+
export declare const Batch: Schema.Struct<{
|
|
281
|
+
readonly id: Schema.String;
|
|
282
|
+
readonly writes: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"insert", {
|
|
283
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
284
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
285
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
286
|
+
readonly value: Schema.String;
|
|
287
|
+
}>, Schema.Struct<{
|
|
288
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
289
|
+
readonly value: Schema.String;
|
|
290
|
+
}>, Schema.Struct<{
|
|
291
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
292
|
+
readonly value: Schema.String;
|
|
293
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
294
|
+
readonly language: Schema.optional<Schema.String>;
|
|
295
|
+
}>]>;
|
|
296
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
297
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
298
|
+
readonly value: Schema.String;
|
|
299
|
+
}>, Schema.Struct<{
|
|
300
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
301
|
+
readonly value: Schema.String;
|
|
302
|
+
}>, Schema.Struct<{
|
|
303
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
304
|
+
readonly value: Schema.String;
|
|
305
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
306
|
+
readonly language: Schema.optional<Schema.String>;
|
|
307
|
+
}>]>;
|
|
308
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
309
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
310
|
+
readonly value: Schema.String;
|
|
311
|
+
}>, Schema.Struct<{
|
|
312
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
313
|
+
readonly value: Schema.String;
|
|
314
|
+
}>, Schema.Struct<{
|
|
315
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
316
|
+
readonly value: Schema.String;
|
|
317
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
318
|
+
readonly language: Schema.optional<Schema.String>;
|
|
319
|
+
}>]>;
|
|
320
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
321
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
322
|
+
readonly value: Schema.String;
|
|
323
|
+
}>, Schema.Struct<{
|
|
324
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
325
|
+
readonly value: Schema.String;
|
|
326
|
+
}>, Schema.Struct<{
|
|
327
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
328
|
+
readonly value: Schema.String;
|
|
329
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
330
|
+
readonly language: Schema.optional<Schema.String>;
|
|
331
|
+
}>]>>;
|
|
332
|
+
}>>;
|
|
333
|
+
}>, Schema.TaggedStruct<"delete", {
|
|
334
|
+
readonly quads: Schema.$Array<Schema.Struct<{
|
|
335
|
+
readonly s: Schema.Union<readonly [Schema.Struct<{
|
|
336
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
337
|
+
readonly value: Schema.String;
|
|
338
|
+
}>, Schema.Struct<{
|
|
339
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
340
|
+
readonly value: Schema.String;
|
|
341
|
+
}>, Schema.Struct<{
|
|
342
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
343
|
+
readonly value: Schema.String;
|
|
344
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
345
|
+
readonly language: Schema.optional<Schema.String>;
|
|
346
|
+
}>]>;
|
|
347
|
+
readonly p: Schema.Union<readonly [Schema.Struct<{
|
|
348
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
349
|
+
readonly value: Schema.String;
|
|
350
|
+
}>, Schema.Struct<{
|
|
351
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
352
|
+
readonly value: Schema.String;
|
|
353
|
+
}>, Schema.Struct<{
|
|
354
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
355
|
+
readonly value: Schema.String;
|
|
356
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
357
|
+
readonly language: Schema.optional<Schema.String>;
|
|
358
|
+
}>]>;
|
|
359
|
+
readonly o: Schema.Union<readonly [Schema.Struct<{
|
|
360
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
361
|
+
readonly value: Schema.String;
|
|
362
|
+
}>, Schema.Struct<{
|
|
363
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
364
|
+
readonly value: Schema.String;
|
|
365
|
+
}>, Schema.Struct<{
|
|
366
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
367
|
+
readonly value: Schema.String;
|
|
368
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
369
|
+
readonly language: Schema.optional<Schema.String>;
|
|
370
|
+
}>]>;
|
|
371
|
+
readonly g: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
372
|
+
readonly termType: Schema.Literal<"NamedNode">;
|
|
373
|
+
readonly value: Schema.String;
|
|
374
|
+
}>, Schema.Struct<{
|
|
375
|
+
readonly termType: Schema.Literal<"BlankNode">;
|
|
376
|
+
readonly value: Schema.String;
|
|
377
|
+
}>, Schema.Struct<{
|
|
378
|
+
readonly termType: Schema.Literal<"Literal">;
|
|
379
|
+
readonly value: Schema.String;
|
|
380
|
+
readonly datatype: Schema.optional<Schema.String>;
|
|
381
|
+
readonly language: Schema.optional<Schema.String>;
|
|
382
|
+
}>]>>;
|
|
383
|
+
}>>;
|
|
384
|
+
}>, Schema.TaggedStruct<"clear", {}>]>>;
|
|
385
|
+
}>;
|
|
386
|
+
export interface Batch extends Schema.Schema.Type<typeof Batch> {
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* How quads move in and out in bulk. `trig`: the Turtle family's text syntax with named graphs, which every fact is
|
|
390
|
+
* stored in and plain Turtle cannot express. `binary`: a term dictionary and the quads as indexes into it, several
|
|
391
|
+
* times smaller and faster to read, for copies between stores.
|
|
392
|
+
*/
|
|
393
|
+
export declare const Format: Schema.Literals<readonly ["trig", "binary"]>;
|
|
394
|
+
export type Format = Schema.Schema.Type<typeof Format>;
|
|
395
|
+
declare const RdfStoreError_base: {
|
|
396
|
+
new (options?: import("@dxos/errors").BaseErrorOptions): {
|
|
397
|
+
cause?: unknown;
|
|
398
|
+
stack?: string;
|
|
399
|
+
name: "RdfStoreError";
|
|
400
|
+
context: Record<string, unknown>;
|
|
401
|
+
readonly message: string;
|
|
402
|
+
readonly _tag: "RdfStoreError";
|
|
403
|
+
};
|
|
404
|
+
isError(error: unknown): error is Error;
|
|
405
|
+
name: "RdfStoreError";
|
|
406
|
+
is(error: unknown): error is BaseError;
|
|
407
|
+
wrap(options?: Omit<import("@dxos/errors").BaseErrorOptions, 'cause'> & {
|
|
408
|
+
ifTypeDiffers?: boolean;
|
|
409
|
+
}): (error: unknown) => {
|
|
410
|
+
cause?: unknown;
|
|
411
|
+
stack?: string;
|
|
412
|
+
name: "RdfStoreError";
|
|
413
|
+
context: Record<string, unknown>;
|
|
414
|
+
readonly message: string;
|
|
415
|
+
readonly _tag: "RdfStoreError";
|
|
416
|
+
};
|
|
417
|
+
extend<Name extends string = string>(name: Name, message?: string): any;
|
|
418
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
419
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
420
|
+
stackTraceLimit: number;
|
|
421
|
+
};
|
|
422
|
+
/** The store refused, could not be reached, or the input does not parse; the message says which. */
|
|
423
|
+
export declare class RdfStoreError extends RdfStoreError_base {
|
|
424
|
+
}
|
|
425
|
+
export type ExportOptions = {
|
|
426
|
+
/** Namespace prefixes a TriG export abbreviates IRIs with, by prefix. */
|
|
427
|
+
readonly prefixes?: Readonly<Record<string, string>>;
|
|
428
|
+
};
|
|
429
|
+
/** What an import added: the batch it wrote, and how many quads it read. */
|
|
430
|
+
export declare const ImportResult: Schema.Struct<{
|
|
431
|
+
readonly batch: Schema.String;
|
|
432
|
+
readonly quads: Schema.Number;
|
|
433
|
+
}>;
|
|
434
|
+
export interface ImportResult extends Schema.Schema.Type<typeof ImportResult> {
|
|
435
|
+
}
|
|
436
|
+
export type QueryOptions = {
|
|
437
|
+
/** Reads the store's local part instead of its shared part. */
|
|
438
|
+
readonly local?: boolean;
|
|
439
|
+
};
|
|
440
|
+
export type WriteOptions = {
|
|
441
|
+
/**
|
|
442
|
+
* Writes the store's local part: kept on this device only, never replicated, and untouched by a `clear` of the
|
|
443
|
+
* shared part. A memory keeps its subscriptions and their undelivered events there.
|
|
444
|
+
*/
|
|
445
|
+
readonly local?: boolean;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* A space's quads in two parts. The shared part is replicated: a write is recorded durably before it is applied, and
|
|
449
|
+
* every replica applies the same batches in the same order. The local part is this device's own.
|
|
450
|
+
*/
|
|
451
|
+
export interface Service {
|
|
452
|
+
/** Runs a SPARQL read (SELECT, ASK or CONSTRUCT); an update fails, since changes go through {@link write}. */
|
|
453
|
+
readonly query: (sparql: string, options?: QueryOptions) => Effect.Effect<readonly MemoryQuery.SparqlRow[], RdfStoreError>;
|
|
454
|
+
/** Applies the writes as one batch and returns its id, once it is durable (shared) or written (local). */
|
|
455
|
+
readonly write: (writes: readonly Write[], options?: WriteOptions) => Effect.Effect<string, RdfStoreError>;
|
|
456
|
+
/** Every quad of the shared part, serialized where the store is, so a large store crosses a boundary once. */
|
|
457
|
+
readonly export: (format: Format, options?: ExportOptions) => Effect.Effect<Uint8Array, RdfStoreError>;
|
|
458
|
+
/** Parses the data where the store is and inserts its quads into the shared part as one batch. */
|
|
459
|
+
readonly import: (data: Uint8Array, format: Format) => Effect.Effect<ImportResult, RdfStoreError>;
|
|
460
|
+
/**
|
|
461
|
+
* Calls `onApplied` with each batch of the shared part once it is applied, this replica's and other replicas' alike,
|
|
462
|
+
* in the order applied, until the scope closes. The listener is registered before this returns, so a reader that
|
|
463
|
+
* listens and then reads misses nothing.
|
|
464
|
+
*/
|
|
465
|
+
readonly listen: (onApplied: (batch: Batch) => void) => Effect.Effect<void, never, Scope.Scope>;
|
|
466
|
+
}
|
|
467
|
+
declare const RdfStore_base: Context.ServiceClass<RdfStore, "@dxos/echo-memory/RdfStore", Service>;
|
|
468
|
+
export declare class RdfStore extends RdfStore_base {
|
|
469
|
+
}
|
|
470
|
+
export {};
|
|
471
|
+
//# sourceMappingURL=RdfStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RdfStore.d.ts","sourceRoot":"","sources":["../../../src/RdfStore.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type * as Schema from 'effect/Schema';
|
|
2
|
+
import * as Fact from './Fact.ts';
|
|
3
|
+
import type * as MemoryQuery from './MemoryQuery.ts';
|
|
4
|
+
import * as Ontology from './Ontology.ts';
|
|
5
|
+
import * as Rdf from './Rdf.ts';
|
|
6
|
+
import type * as RdfStore from './RdfStore.ts';
|
|
7
|
+
/** A fact query in its plain form. */
|
|
8
|
+
export type Pattern = Schema.Codec.Encoded<typeof MemoryQuery.FactQuery>;
|
|
9
|
+
/** A solution as an engine reports it: a variable it leaves unbound may be present as `undefined`. */
|
|
10
|
+
export type Row = Readonly<Record<string, MemoryQuery.SparqlTerm | undefined>>;
|
|
11
|
+
/** Every quad of the ontology graph (predicate labels), as `?g ?s ?p ?o`. */
|
|
12
|
+
export declare const ONTOLOGY_SPARQL: string;
|
|
13
|
+
/** The distinct predicates of every stored statement. */
|
|
14
|
+
export declare const STORED_PREDICATES_SPARQL: string;
|
|
15
|
+
/** Every predicate the ontology graph already describes as an `rdf:Property`. */
|
|
16
|
+
export declare const DESCRIBED_PREDICATES_SPARQL: string;
|
|
17
|
+
/** The seed-version marker, kept in the default graph about the ontology graph. */
|
|
18
|
+
export declare const SEED_MARKER_SPARQL: string;
|
|
19
|
+
/** SPARQL UPDATEs removing the seed marker and the ontology-graph description of each of `iris`, one per request. */
|
|
20
|
+
export declare const deleteSeedSparql: (iris: readonly string[]) => string[];
|
|
21
|
+
/** The label of each stored predicate: from the ontology graph, else the ontology, else its IRI. */
|
|
22
|
+
export declare const predicateLabels: (stored: Iterable<string>, ontologyQuads: readonly Rdf.Quad[], ontology?: Ontology.Ontology) => Map<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Group pattern binding `?g` to every named graph holding a statement that matches each of the query's
|
|
25
|
+
* constraints, with `predicates` the IRIs its predicate names. Confidence is not a constraint here: the caller
|
|
26
|
+
* re-checks every statement (`statementMatches`).
|
|
27
|
+
*/
|
|
28
|
+
export declare const candidateGraphs: (query: Pattern, predicates?: ReadonlySet<string>) => string;
|
|
29
|
+
/** Group pattern binding `?g` to exactly the given graph IRIs. */
|
|
30
|
+
export declare const graphValues: (graphs: readonly string[]) => string;
|
|
31
|
+
/**
|
|
32
|
+
* SPARQL loading every quad of the graphs `candidates` binds, as `?g ?s ?p ?o`, and each graph's provenance from
|
|
33
|
+
* the default graph, as `?g ?p ?o` with `?s` unbound.
|
|
34
|
+
*/
|
|
35
|
+
export declare const graphQuadsSparql: (candidates: string) => string;
|
|
36
|
+
/**
|
|
37
|
+
* The stored predicates a query's predicate names: those its surface form resolves to through the ontology, and
|
|
38
|
+
* those whose label or synonyms share its relation key, either way round, since a model rarely reproduces the
|
|
39
|
+
* stored phrase verbatim.
|
|
40
|
+
*/
|
|
41
|
+
export declare const matchingPredicates: (surface: string, predicates: ReadonlyMap<string, string>, ontology?: Ontology.Ontology) => Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether a statement satisfies the query. Candidate graphs are found by any statement in them, so each statement
|
|
44
|
+
* is checked again here: a graph about Rich may also hold a statement about DXOS.
|
|
45
|
+
*/
|
|
46
|
+
export declare const statementMatches: (fact: Fact.Fact, query: Pattern, predicates?: ReadonlySet<string>) => boolean;
|
|
47
|
+
/** RDF/JS term → the engine's plain-data term. */
|
|
48
|
+
export declare const toTerm: (term: Rdf.Term) => MemoryQuery.SparqlTerm;
|
|
49
|
+
/** RDF/JS quad → engine quad (the default graph is the engine's absent `g`). */
|
|
50
|
+
export declare const toQuad: (triple: Rdf.Quad) => RdfStore.Quad;
|
|
51
|
+
/**
|
|
52
|
+
* `?g ?s ?p ?o` solutions as quads: a row with `?s` bound is a quad in graph `?g`, one without it is a default-graph
|
|
53
|
+
* triple about `?g` (its provenance). Rows with a literal in a resource position are skipped.
|
|
54
|
+
*/
|
|
55
|
+
export declare const rowsToQuads: (rows: readonly Row[]) => Rdf.Quad[];
|
|
56
|
+
/** The distinct graph IRIs a raw SELECT binds to `?g`, or to `?fact`, the variable of the earlier reified shape. */
|
|
57
|
+
export declare const boundGraphs: (rows: readonly Row[]) => string[];
|
|
58
|
+
//# sourceMappingURL=Sparql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sparql.d.ts","sourceRoot":"","sources":["../../../src/Sparql.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAS/C,sCAAsC;AACtC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC;AAEzE,sGAAsG;AACtG,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;AA0B/E,6EAA6E;AAC7E,eAAO,MAAM,eAAe,QAAiF,CAAC;AAE9G,yDAAyD;AACzD,eAAO,MAAM,wBAAwB,QAA4F,CAAC;AAElI,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,QAAkH,CAAC;AAE3J,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,QAAgE,CAAC;AAEhG,qHAAqH;AACrH,eAAO,MAAM,gBAAgB,SAAU,SAAS,MAAM,EAAE,KAAG,MAAM,EAGhE,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,eAAe,WAClB,QAAQ,CAAC,MAAM,CAAC,iBACT,SAAS,GAAG,CAAC,IAAI,EAAE,aACxB,QAAQ,CAAC,QAAQ,KAC1B,GAAG,CAAC,MAAM,EAAE,MAAM,CAUpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,OAAO,eAAe,WAAW,CAAC,MAAM,CAAC,KAAG,MAqBlF,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,WAAW,WAAY,SAAS,MAAM,EAAE,KAAG,MAAyD,CAAC;AAElH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,eAAgB,MAAM,KAAG,MACsE,CAAC;AAS7H;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,YACpB,MAAM,cACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,aAC7B,QAAQ,CAAC,QAAQ,KAC1B,GAAG,CAAC,MAAM,CAeZ,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,SAAU,IAAI,CAAC,IAAI,SAAS,OAAO,eAAe,WAAW,CAAC,MAAM,CAAC,KAAG,OAYpG,CAAC;AAMF,kDAAkD;AAClD,eAAO,MAAM,MAAM,SAAU,GAAG,CAAC,IAAI,KAAG,WAAW,CAAC,UAcnD,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,MAAM,WAAY,GAAG,CAAC,IAAI,KAAG,QAAQ,CAAC,IAKjD,CAAC;AAUH;;;GAGG;AACH,eAAO,MAAM,WAAW,SAAU,SAAS,GAAG,EAAE,KAAG,GAAG,CAAC,IAAI,EASvD,CAAC;AAEL,oHAAoH;AACpH,eAAO,MAAM,WAAW,SAAU,SAAS,GAAG,EAAE,KAAG,MAAM,EAOxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sparql.test.d.ts","sourceRoot":"","sources":["../../../src/Sparql.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
/** A subscription's id, unique in its space; chosen by the caller. */
|
|
3
|
+
export declare const SubscriptionId: Schema.brand<Schema.String, "@dxos/echo-memory/SubscriptionId">;
|
|
4
|
+
export type SubscriptionId = Schema.Schema.Type<typeof SubscriptionId>;
|
|
5
|
+
/** An event's id, stable per subscription, wake and facts, so a wake derived twice queues once. */
|
|
6
|
+
export declare const MemoryEventId: Schema.brand<Schema.String, "@dxos/echo-memory/MemoryEventId">;
|
|
7
|
+
export type MemoryEventId = Schema.Schema.Type<typeof MemoryEventId>;
|
|
8
|
+
/** Most subscriptions one space's memory holds at once. */
|
|
9
|
+
export declare const MAX_SUBSCRIPTIONS = 256;
|
|
10
|
+
/** Goal rules held against a space's memory, and the caller's own record of why. */
|
|
11
|
+
export declare const Subscription: Schema.Struct<{
|
|
12
|
+
readonly id: Schema.brand<Schema.String, "@dxos/echo-memory/SubscriptionId">;
|
|
13
|
+
/** The agent that holds it; `subscriptions(owner)` filters by it. */
|
|
14
|
+
readonly owner: Schema.optional<Schema.brand<Schema.String, "@dxos/echo-memory/EntityKey">>;
|
|
15
|
+
/** Datalog goal rules (`@dxos/brain`). */
|
|
16
|
+
readonly rules: Schema.String;
|
|
17
|
+
/** ISO; facts put before it wake nothing. */
|
|
18
|
+
readonly createdAt: Schema.String;
|
|
19
|
+
/** Stored and returned as is; never interpreted by memory. */
|
|
20
|
+
readonly payload: Schema.optional<Schema.Unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
export interface Subscription extends Schema.Schema.Type<typeof Subscription> {
|
|
23
|
+
}
|
|
24
|
+
/** One wake of a subscription's rules, queued in its outbox until acknowledged. */
|
|
25
|
+
export declare const MemoryEvent: Schema.Struct<{
|
|
26
|
+
readonly id: Schema.brand<Schema.String, "@dxos/echo-memory/MemoryEventId">;
|
|
27
|
+
readonly subscription: Schema.brand<Schema.String, "@dxos/echo-memory/SubscriptionId">;
|
|
28
|
+
/** The rules' wake label, `achieved`, or a sub-goal id. */
|
|
29
|
+
readonly label: Schema.String;
|
|
30
|
+
/** The facts behind the wake; empty for a wake the clock caused. */
|
|
31
|
+
readonly facts: Schema.$Array<Schema.Struct<{
|
|
32
|
+
readonly id: Schema.brand<Schema.String, "@dxos/echo-memory/FactId">;
|
|
33
|
+
readonly graph: Schema.optional<Schema.brand<Schema.String, "@dxos/echo-memory/GraphIri">>;
|
|
34
|
+
readonly assertion: Schema.Struct<{
|
|
35
|
+
readonly subject: Schema.Union<readonly [Schema.Struct<{
|
|
36
|
+
readonly kind: Schema.Literal<"entity">;
|
|
37
|
+
readonly entity: Schema.brand<Schema.String, "@dxos/echo-memory/EntityKey">;
|
|
38
|
+
readonly label: Schema.optional<Schema.String>;
|
|
39
|
+
readonly type: Schema.optional<Schema.Literals<readonly ["person", "org", "place", "event", "concept", "thing"]>>;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly kind: Schema.Literal<"literal">;
|
|
42
|
+
readonly literal: Schema.String;
|
|
43
|
+
}>]>;
|
|
44
|
+
readonly predicate: Schema.String;
|
|
45
|
+
readonly predicateIri: Schema.optional<Schema.String>;
|
|
46
|
+
readonly predicateDescription: Schema.optional<Schema.String>;
|
|
47
|
+
readonly object: Schema.Union<readonly [Schema.Struct<{
|
|
48
|
+
readonly kind: Schema.Literal<"entity">;
|
|
49
|
+
readonly entity: Schema.brand<Schema.String, "@dxos/echo-memory/EntityKey">;
|
|
50
|
+
readonly label: Schema.optional<Schema.String>;
|
|
51
|
+
readonly type: Schema.optional<Schema.Literals<readonly ["person", "org", "place", "event", "concept", "thing"]>>;
|
|
52
|
+
}>, Schema.Struct<{
|
|
53
|
+
readonly kind: Schema.Literal<"literal">;
|
|
54
|
+
readonly literal: Schema.String;
|
|
55
|
+
}>]>;
|
|
56
|
+
readonly validFrom: Schema.optional<Schema.String>;
|
|
57
|
+
readonly validTo: Schema.optional<Schema.String>;
|
|
58
|
+
readonly quote: Schema.optional<Schema.String>;
|
|
59
|
+
}>;
|
|
60
|
+
readonly factuality: Schema.Struct<{
|
|
61
|
+
readonly value: Schema.Literals<readonly ["CT+", "CT-", "PR+", "PR-", "PS+", "PS-", "CTu", "Uu"]>;
|
|
62
|
+
readonly polarity: Schema.Literals<readonly ["+", "-", "?"]>;
|
|
63
|
+
readonly confidence: Schema.optional<Schema.Number>;
|
|
64
|
+
readonly nature: Schema.optional<Schema.Literals<readonly ["epistemic", "aleatory"]>>;
|
|
65
|
+
}>;
|
|
66
|
+
readonly illocution: Schema.optional<Schema.Struct<{
|
|
67
|
+
readonly force: Schema.Literals<readonly ["assertive", "directive", "commissive", "expressive"]>;
|
|
68
|
+
readonly mood: Schema.optional<Schema.Literals<readonly ["declarative", "interrogative", "imperative"]>>;
|
|
69
|
+
readonly addressee: Schema.optional<Schema.String>;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly attribution: Schema.Struct<{
|
|
72
|
+
readonly agent: Schema.optional<Schema.brand<Schema.String, "@dxos/echo-memory/EntityKey">>;
|
|
73
|
+
readonly agentLabel: Schema.optional<Schema.String>;
|
|
74
|
+
readonly source: Schema.brand<Schema.String, "@dxos/echo-memory/SourceUri">;
|
|
75
|
+
readonly generatedAtTime: Schema.String;
|
|
76
|
+
readonly wasDerivedFrom: Schema.optional<Schema.$Array<Schema.String>>;
|
|
77
|
+
readonly span: Schema.optional<Schema.Struct<{
|
|
78
|
+
readonly start: Schema.Number;
|
|
79
|
+
readonly end: Schema.Number;
|
|
80
|
+
}>>;
|
|
81
|
+
}>;
|
|
82
|
+
readonly recordedAt: Schema.String;
|
|
83
|
+
readonly extractor: Schema.Struct<{
|
|
84
|
+
readonly id: Schema.String;
|
|
85
|
+
readonly model: Schema.String;
|
|
86
|
+
readonly version: Schema.String;
|
|
87
|
+
}>;
|
|
88
|
+
readonly sourceHash: Schema.String;
|
|
89
|
+
readonly pass: Schema.optional<Schema.String>;
|
|
90
|
+
readonly kind: Schema.optional<Schema.String>;
|
|
91
|
+
readonly origin: Schema.optional<Schema.String>;
|
|
92
|
+
readonly supersedes: Schema.optional<Schema.$Array<Schema.brand<Schema.String, "@dxos/echo-memory/GraphIri">>>;
|
|
93
|
+
readonly retracts: Schema.optional<Schema.$Array<Schema.brand<Schema.String, "@dxos/echo-memory/GraphIri">>>;
|
|
94
|
+
}>>;
|
|
95
|
+
/** When it woke (ISO). */
|
|
96
|
+
readonly at: Schema.String;
|
|
97
|
+
}>;
|
|
98
|
+
export interface MemoryEvent extends Schema.Schema.Type<typeof MemoryEvent> {
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=Subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../../src/Subscription.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,sEAAsE;AACtE,eAAO,MAAM,cAAc,iEAAuE,CAAC;AACnG,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,cAAc,CAAC,CAAC;AAEvE,mGAAmG;AACnG,eAAO,MAAM,aAAa,gEAAsE,CAAC;AACjG,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC,CAAC;AAErE,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,oFAAoF;AACpF,eAAO,MAAM,YAAY;;IAEvB,qEAAqE;;IAErE,0CAA0C;;IAE1C,6CAA6C;;IAE7C,8DAA8D;;EAE9D,CAAC;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,YAAY,CAAC;CAAG;AAEhF,mFAAmF;AACnF,eAAO,MAAM,WAAW;;;IAGtB,2DAA2D;;IAE3D,oEAAoE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEpE,0BAA0B;;EAE1B,CAAC;AACH,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC;CAAG"}
|