eyeling 1.32.0 → 1.32.1

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/index.d.ts CHANGED
@@ -1,286 +1,245 @@
1
- declare module 'eyeling' {
2
- export type RdfJsTerm = import('@rdfjs/types').Term;
3
- export type RdfJsNamedNode = import('@rdfjs/types').NamedNode;
4
- export type RdfJsBlankNode = import('@rdfjs/types').BlankNode;
5
- export type RdfJsVariable = import('@rdfjs/types').Variable;
6
- export type RdfJsDefaultGraph = import('@rdfjs/types').DefaultGraph;
7
- export type RdfJsLiteral = import('@rdfjs/types').Literal;
8
- export type RdfJsQuad = import('@rdfjs/types').Quad;
9
- export type RdfJsDataFactory = import('@rdfjs/types').DataFactory<RdfJsQuad> & {
10
- variable(value: string): RdfJsVariable;
11
- };
12
-
13
- export interface EyelingPrefixEnv {
14
- _type?: 'PrefixEnv';
15
- map: Record<string, string>;
16
- baseIri?: string;
17
- }
18
-
19
- export interface EyelingIri {
20
- _type?: 'Iri';
21
- value: string;
22
- }
23
-
24
- export interface EyelingLiteral {
25
- _type?: 'Literal';
26
- value: string;
27
- }
28
-
29
- export interface EyelingVar {
30
- _type?: 'Var';
31
- name: string;
32
- }
33
-
34
- export interface EyelingBlank {
35
- _type?: 'Blank';
36
- label: string;
37
- }
38
-
39
- export interface EyelingListTerm {
40
- _type?: 'ListTerm';
41
- elems: EyelingTerm[];
42
- }
43
-
44
- export interface EyelingOpenListTerm {
45
- _type?: 'OpenListTerm';
46
- prefix: EyelingTerm[];
47
- tailVar: string;
48
- }
49
-
50
- export interface EyelingGraphTerm {
51
- _type?: 'GraphTerm';
52
- triples: EyelingTriple[];
53
- }
54
-
55
- export type EyelingTerm =
56
- | EyelingIri
57
- | EyelingLiteral
58
- | EyelingVar
59
- | EyelingBlank
60
- | EyelingListTerm
61
- | EyelingOpenListTerm
62
- | EyelingGraphTerm
63
- | RdfJsNamedNode
64
- | RdfJsBlankNode
65
- | RdfJsVariable
66
- | RdfJsLiteral
67
- | RdfJsQuad;
1
+ export interface EyelingPrefixEnv {
2
+ _type?: 'PrefixEnv';
3
+ map: Record<string, string>;
4
+ baseIri?: string;
5
+ }
68
6
 
69
- export interface EyelingTriple {
70
- _type?: 'Triple';
71
- s: EyelingTerm;
72
- p: EyelingTerm;
73
- o: EyelingTerm;
74
- }
7
+ export interface EyelingIri {
8
+ _type?: 'Iri';
9
+ value: string;
10
+ }
75
11
 
76
- export interface EyelingRule {
77
- _type?: 'Rule';
78
- premise: EyelingTriple[];
79
- conclusion: EyelingTriple[];
80
- isForward?: boolean;
81
- isFuse?: boolean;
82
- headBlankLabels?: Iterable<string> | string[];
83
- __dynamicConclusionTerm?: EyelingTerm;
84
- }
12
+ export interface EyelingLiteral {
13
+ _type?: 'Literal';
14
+ value: string;
15
+ }
85
16
 
86
- export type EyelingAstBundle = [EyelingPrefixEnv, EyelingTriple[], EyelingRule[], EyelingRule[], EyelingRule[]?];
17
+ export interface EyelingVar {
18
+ _type?: 'Var';
19
+ name: string;
20
+ }
87
21
 
88
- export type N3Source = string | { n3?: string; text?: string; baseIri?: string; label?: string };
22
+ export interface EyelingBlank {
23
+ _type?: 'Blank';
24
+ label: string;
25
+ }
89
26
 
90
- export interface N3SourceListInput {
91
- sources: N3Source[];
92
- scopeBlankNodes?: boolean;
93
- }
27
+ export interface EyelingListTerm {
28
+ _type?: 'ListTerm';
29
+ elems: EyelingTerm[];
30
+ }
94
31
 
95
- export interface RdfJsReasonInput {
96
- n3?: string;
97
- quads?: Iterable<RdfJsQuad> | AsyncIterable<RdfJsQuad>;
98
- facts?: Iterable<RdfJsQuad> | AsyncIterable<RdfJsQuad>;
99
- dataset?: Iterable<RdfJsQuad> | AsyncIterable<RdfJsQuad>;
100
- rules?: EyelingRule[] | EyelingAstBundle;
101
- factsN3?: string;
102
- n3Facts?: string;
103
- prefixesN3?: string;
104
- n3Prefixes?: string;
105
- prefixes?: EyelingPrefixEnv;
106
- triples?: EyelingTriple[];
107
- forwardRules?: EyelingRule[];
108
- frules?: EyelingRule[];
109
- backwardRules?: EyelingRule[];
110
- brules?: EyelingRule[];
111
- queryRules?: EyelingRule[];
112
- logQueryRules?: EyelingRule[];
113
- qrules?: EyelingRule[];
114
- ast?: EyelingAstBundle;
115
- document?: EyelingAstBundle;
116
- }
32
+ export interface EyelingOpenListTerm {
33
+ _type?: 'OpenListTerm';
34
+ prefix: EyelingTerm[];
35
+ tailVar: string;
36
+ }
117
37
 
118
- export interface StoreOptions {
119
- name?: string;
120
- clear?: boolean;
121
- path?: string;
122
- type?: 'memory' | 'persistent';
123
- backend?: 'memory' | 'level' | 'indexeddb';
124
- }
38
+ export interface EyelingGraphTerm {
39
+ _type?: 'GraphTerm';
40
+ triples: EyelingTriple[];
41
+ }
125
42
 
126
- export interface ReasonOptions {
127
- proof?: boolean;
128
- proofComments?: boolean;
129
- noProofComments?: boolean;
130
- args?: string[];
131
- maxBuffer?: number;
132
- builtinModules?: string | string[];
133
- store?: string | StoreOptions;
134
- storePath?: string;
135
- storeClear?: boolean;
136
- }
43
+ export type EyelingTerm =
44
+ | EyelingIri
45
+ | EyelingLiteral
46
+ | EyelingVar
47
+ | EyelingBlank
48
+ | EyelingListTerm
49
+ | EyelingOpenListTerm
50
+ | EyelingGraphTerm
51
+ | import('@rdfjs/types').NamedNode
52
+ | import('@rdfjs/types').BlankNode
53
+ | import('@rdfjs/types').Variable
54
+ | import('@rdfjs/types').Literal
55
+ | import('@rdfjs/types').Quad;
56
+
57
+ export interface EyelingTriple {
58
+ _type?: 'Triple';
59
+ s: EyelingTerm;
60
+ p: EyelingTerm;
61
+ o: EyelingTerm;
62
+ }
137
63
 
138
- export interface BuiltinRegistrationContext {
139
- iri: string;
140
- goal: EyelingTriple;
141
- subst: Record<string, EyelingTerm>;
142
- facts: any[];
143
- backRules: EyelingRule[];
144
- depth: number;
145
- varGen: number[];
146
- maxResults?: number;
147
- api: any;
148
- }
64
+ export interface EyelingRule {
65
+ _type?: 'Rule';
66
+ premise: EyelingTriple[];
67
+ conclusion: EyelingTriple[];
68
+ isForward?: boolean;
69
+ isFuse?: boolean;
70
+ headBlankLabels?: Iterable<string> | string[];
71
+ __dynamicConclusionTerm?: EyelingTerm;
72
+ }
149
73
 
150
- export type BuiltinHandler = (ctx: BuiltinRegistrationContext) => Array<Record<string, EyelingTerm>>;
74
+ export type EyelingAstBundle = [EyelingPrefixEnv, EyelingTriple[], EyelingRule[], EyelingRule[], EyelingRule[]?];
151
75
 
152
- export interface ReasonStreamOptions {
153
- baseIri?: string | null;
154
- proof?: boolean;
155
- includeInputFactsInClosure?: boolean;
156
- enforceHttps?: boolean;
157
- rdfjs?: boolean;
158
- dataFactory?: RdfJsDataFactory | null;
159
- skipUnsupportedRdfJs?: boolean;
160
- builtinModules?: string | string[];
161
- store?: string | StoreOptions;
162
- storePath?: string;
163
- storeClear?: boolean;
164
- onDerived?: (item: { triple: string; quad?: RdfJsQuad; quads?: RdfJsQuad[]; df: any }) => void;
165
- }
76
+ export type N3Source = string | { n3?: string; text?: string; baseIri?: string; label?: string };
166
77
 
167
- export interface ReasonStreamResult {
168
- prefixes: any;
169
- facts: any[];
170
- derived: any[];
171
- queryMode: boolean;
172
- queryTriples: any[];
173
- queryDerived: any[];
174
- closureN3: string;
175
- closureQuads?: RdfJsQuad[];
176
- queryQuads?: RdfJsQuad[];
177
- }
78
+ export interface N3SourceListInput {
79
+ sources: N3Source[];
80
+ scopeBlankNodes?: boolean;
81
+ }
178
82
 
179
- export interface FactStore {
180
- add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
181
- has(triple: EyelingTriple): Promise<boolean>;
182
- kindOf?(triple: EyelingTriple): Promise<number>;
183
- match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
184
- batchAdd?(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
185
- clear?(): Promise<void>;
186
- close?(): Promise<void>;
187
- }
83
+ export interface RdfJsReasonInput {
84
+ n3?: string;
85
+ quads?: Iterable<import('@rdfjs/types').Quad> | AsyncIterable<import('@rdfjs/types').Quad>;
86
+ facts?: Iterable<import('@rdfjs/types').Quad> | AsyncIterable<import('@rdfjs/types').Quad>;
87
+ dataset?: Iterable<import('@rdfjs/types').Quad> | AsyncIterable<import('@rdfjs/types').Quad>;
88
+ rules?: EyelingRule[] | EyelingAstBundle;
89
+ factsN3?: string;
90
+ n3Facts?: string;
91
+ prefixesN3?: string;
92
+ n3Prefixes?: string;
93
+ prefixes?: EyelingPrefixEnv;
94
+ triples?: EyelingTriple[];
95
+ forwardRules?: EyelingRule[];
96
+ frules?: EyelingRule[];
97
+ backwardRules?: EyelingRule[];
98
+ brules?: EyelingRule[];
99
+ queryRules?: EyelingRule[];
100
+ logQueryRules?: EyelingRule[];
101
+ qrules?: EyelingRule[];
102
+ ast?: EyelingAstBundle;
103
+ document?: EyelingAstBundle;
104
+ }
188
105
 
189
- export class MemoryFactStore implements FactStore {
190
- constructor();
191
- add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
192
- has(triple: EyelingTriple): Promise<boolean>;
193
- kindOf(triple: EyelingTriple): Promise<number>;
194
- match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
195
- batchAdd(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
196
- clear(): Promise<void>;
197
- close(): Promise<void>;
198
- }
106
+ export interface StoreOptions {
107
+ name?: string;
108
+ clear?: boolean;
109
+ path?: string;
110
+ type?: 'memory' | 'persistent';
111
+ backend?: 'memory' | 'level' | 'indexeddb';
112
+ }
199
113
 
200
- export class PersistentFactStore implements FactStore {
201
- add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
202
- has(triple: EyelingTriple): Promise<boolean>;
203
- kindOf(triple: EyelingTriple): Promise<number>;
204
- match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
205
- batchAdd(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
206
- clear(): Promise<void>;
207
- close(): Promise<void>;
208
- }
114
+ export interface ReasonOptions {
115
+ proof?: boolean;
116
+ proofComments?: boolean;
117
+ noProofComments?: boolean;
118
+ rdf?: boolean;
119
+ args?: string[];
120
+ maxBuffer?: number;
121
+ builtinModules?: string | string[];
122
+ store?: string | StoreOptions;
123
+ storePath?: string;
124
+ storeClear?: boolean;
125
+ }
209
126
 
210
- export function reason(
211
- opts: ReasonOptions,
212
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
213
- ): string;
214
- export function runAsync(
215
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
216
- opts?: ReasonStreamOptions,
217
- ): Promise<ReasonStreamResult & { store?: FactStore }>;
218
- export function reasonStream(
219
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
220
- opts?: ReasonStreamOptions,
221
- ): ReasonStreamResult;
222
- export function reasonRdfJs(
223
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
224
- opts?: Omit<ReasonStreamOptions, 'rdfjs' | 'onDerived'>,
225
- ): AsyncIterable<RdfJsQuad>;
127
+ export interface BuiltinRegistrationContext {
128
+ iri: string;
129
+ goal: EyelingTriple;
130
+ subst: Record<string, EyelingTerm>;
131
+ facts: EyelingTriple[];
132
+ backRules: EyelingRule[];
133
+ depth: number;
134
+ varGen: number[];
135
+ maxResults?: number;
136
+ api: unknown;
137
+ }
226
138
 
227
- export const INFERENCE_FUSE_EXIT_CODE: 65;
228
- export const rdfjs: RdfJsDataFactory;
229
- export function createFactStore(options?: string | StoreOptions | null): Promise<FactStore>;
230
- export function registerBuiltin(iri: string, handler: BuiltinHandler): BuiltinHandler;
231
- export function unregisterBuiltin(iri: string): boolean;
232
- export function registerBuiltinModule(mod: any, origin?: string): boolean;
233
- export function loadBuiltinModule(specifier: string, options?: { resolveFrom?: string }): string;
234
- export function listBuiltinIris(): string[];
139
+ export type BuiltinHandler = (ctx: BuiltinRegistrationContext) => Array<Record<string, EyelingTerm>>;
140
+
141
+ export interface ReasonStreamOptions {
142
+ baseIri?: string | null;
143
+ proof?: boolean;
144
+ includeInputFactsInClosure?: boolean;
145
+ enforceHttps?: boolean;
146
+ rdfjs?: boolean;
147
+ dataFactory?: import('@rdfjs/types').DataFactory<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad> | null;
148
+ skipUnsupportedRdfJs?: boolean;
149
+ builtinModules?: string | string[];
150
+ store?: string | StoreOptions;
151
+ storePath?: string;
152
+ storeClear?: boolean;
153
+ onDerived?: (item: { triple: string; quad?: import('@rdfjs/types').Quad; quads?: import('@rdfjs/types').Quad[]; df: import('@rdfjs/types').DataFactory<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad> }) => void;
235
154
  }
236
155
 
237
- declare module 'eyeling/browser' {
238
- export type RdfJsDataFactory = import('eyeling').RdfJsDataFactory;
239
- export type RdfJsQuad = import('eyeling').RdfJsQuad;
240
- export type RdfJsReasonInput = import('eyeling').RdfJsReasonInput;
241
- export type EyelingAstBundle = import('eyeling').EyelingAstBundle;
242
- export type N3Source = import('eyeling').N3Source;
243
- export type N3SourceListInput = import('eyeling').N3SourceListInput;
244
- export type ReasonStreamOptions = import('eyeling').ReasonStreamOptions;
245
- export type ReasonStreamResult = import('eyeling').ReasonStreamResult;
246
- export type BuiltinHandler = import('eyeling').BuiltinHandler;
247
- export type StoreOptions = import('eyeling').StoreOptions;
248
- export type FactStore = import('eyeling').FactStore;
156
+ export interface ReasonStreamResult {
157
+ prefixes: EyelingPrefixEnv;
158
+ facts: EyelingTriple[];
159
+ derived: EyelingTriple[];
160
+ queryMode: boolean;
161
+ queryTriples: EyelingTriple[];
162
+ queryDerived: EyelingTriple[];
163
+ closureN3: string;
164
+ closureQuads?: import('@rdfjs/types').Quad[];
165
+ queryQuads?: import('@rdfjs/types').Quad[];
166
+ }
249
167
 
250
- export function runAsync(
251
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
252
- opts?: ReasonStreamOptions,
253
- ): Promise<ReasonStreamResult & { store?: FactStore }>;
254
- export function reasonStream(
255
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
256
- opts?: ReasonStreamOptions,
257
- ): ReasonStreamResult;
258
- export function reasonRdfJs(
259
- input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
260
- opts?: Omit<ReasonStreamOptions, 'rdfjs' | 'onDerived'>,
261
- ): AsyncIterable<RdfJsQuad>;
168
+ export interface FactStore {
169
+ add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
170
+ has(triple: EyelingTriple): Promise<boolean>;
171
+ kindOf?(triple: EyelingTriple): Promise<number>;
172
+ match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
173
+ batchAdd?(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
174
+ clear?(): Promise<void>;
175
+ close?(): Promise<void>;
176
+ }
262
177
 
263
- export const INFERENCE_FUSE_EXIT_CODE: 65;
264
- export const rdfjs: RdfJsDataFactory;
265
- export function createFactStore(options?: string | StoreOptions | null): Promise<FactStore>;
266
- export function registerBuiltin(iri: string, handler: BuiltinHandler): BuiltinHandler;
267
- export function unregisterBuiltin(iri: string): boolean;
268
- export function registerBuiltinModule(mod: any, origin?: string): boolean;
269
- export function listBuiltinIris(): string[];
178
+ export class MemoryFactStore implements FactStore {
179
+ constructor();
180
+ add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
181
+ has(triple: EyelingTriple): Promise<boolean>;
182
+ kindOf(triple: EyelingTriple): Promise<number>;
183
+ match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
184
+ batchAdd(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
185
+ clear(): Promise<void>;
186
+ close(): Promise<void>;
187
+ }
270
188
 
271
- const eyeling: {
272
- readonly version: string;
273
- runAsync: typeof runAsync;
274
- reasonStream: typeof reasonStream;
275
- reasonRdfJs: typeof reasonRdfJs;
276
- readonly INFERENCE_FUSE_EXIT_CODE: typeof INFERENCE_FUSE_EXIT_CODE;
277
- rdfjs: typeof rdfjs;
278
- createFactStore: typeof createFactStore;
279
- registerBuiltin: typeof registerBuiltin;
280
- unregisterBuiltin: typeof unregisterBuiltin;
281
- registerBuiltinModule: typeof registerBuiltinModule;
282
- listBuiltinIris: typeof listBuiltinIris;
283
- };
189
+ export class PersistentFactStore implements FactStore {
190
+ constructor(kv?: unknown, options?: StoreOptions);
191
+ add(triple: EyelingTriple, kind?: 'explicit' | 'inferred'): Promise<boolean>;
192
+ has(triple: EyelingTriple): Promise<boolean>;
193
+ kindOf(triple: EyelingTriple): Promise<number>;
194
+ match(s?: EyelingTerm | null, p?: EyelingTerm | null, o?: EyelingTerm | null): AsyncIterable<EyelingTriple>;
195
+ batchAdd(triples: Iterable<EyelingTriple>, kind?: 'explicit' | 'inferred'): Promise<number>;
196
+ clear(): Promise<void>;
197
+ close(): Promise<void>;
198
+ }
284
199
 
285
- export default eyeling;
200
+ export function reason(
201
+ opts: ReasonOptions,
202
+ input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
203
+ ): string;
204
+ export function runAsync(
205
+ input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
206
+ opts?: ReasonStreamOptions,
207
+ ): Promise<ReasonStreamResult & { store?: FactStore }>;
208
+ export function reasonStream(
209
+ input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
210
+ opts?: ReasonStreamOptions,
211
+ ): ReasonStreamResult;
212
+ export function reasonRdfJs(
213
+ input: string | RdfJsReasonInput | EyelingAstBundle | N3SourceListInput,
214
+ opts?: Omit<ReasonStreamOptions, 'rdfjs' | 'onDerived'>,
215
+ ): AsyncIterable<import('@rdfjs/types').Quad>;
216
+
217
+ export const INFERENCE_FUSE_EXIT_CODE: 65;
218
+ export const rdfjs: import('@rdfjs/types').DataFactory<import('@rdfjs/types').Quad, import('@rdfjs/types').Quad> & { variable(value: string): import('@rdfjs/types').Variable };
219
+ export function createFactStore(options?: string | StoreOptions | null): Promise<FactStore>;
220
+ export function registerBuiltin(iri: string, handler: BuiltinHandler): BuiltinHandler;
221
+ export function unregisterBuiltin(iri: string): boolean;
222
+ export function registerBuiltinModule(mod: unknown, origin?: string): boolean;
223
+ export function loadBuiltinModule(specifier: string, options?: { resolveFrom?: string }): string;
224
+ export function listBuiltinIris(): string[];
225
+
226
+ export interface EyelingModule {
227
+ readonly version: string;
228
+ reason: typeof reason;
229
+ runAsync: typeof runAsync;
230
+ reasonStream: typeof reasonStream;
231
+ reasonRdfJs: typeof reasonRdfJs;
232
+ readonly INFERENCE_FUSE_EXIT_CODE: typeof INFERENCE_FUSE_EXIT_CODE;
233
+ rdfjs: typeof rdfjs;
234
+ createFactStore: typeof createFactStore;
235
+ MemoryFactStore: typeof MemoryFactStore;
236
+ PersistentFactStore: typeof PersistentFactStore;
237
+ registerBuiltin: typeof registerBuiltin;
238
+ unregisterBuiltin: typeof unregisterBuiltin;
239
+ registerBuiltinModule: typeof registerBuiltinModule;
240
+ loadBuiltinModule: typeof loadBuiltinModule;
241
+ listBuiltinIris: typeof listBuiltinIris;
286
242
  }
243
+
244
+ declare const eyeling: EyelingModule;
245
+ export default eyeling;