eyeling 1.15.13 → 1.16.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/HANDBOOK.md +25 -5
- package/README.md +78 -1
- package/arctifacts/README.md +57 -0
- package/eyeling.js +894 -9
- package/index.d.ts +184 -1
- package/index.js +17 -7
- package/lib/engine.js +92 -8
- package/lib/entry.js +3 -0
- package/lib/rdfjs.js +795 -0
- package/package.json +2 -2
- package/test/api.test.js +263 -0
- package/tools/bundle.js +1 -1
- package/follows-from/index.html +0 -549
- package/follows-from/library/index.md +0 -22
- package/follows-from/logo.svg +0 -12
- package/follows-from/manifesto.md +0 -48
- package/follows-from/method/index.md +0 -30
- package/follows-from/path/index.md +0 -20
- /package/{follows-from/artifacts → arctifacts}/ackermann.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/auroracare.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/bike-trip.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/binomial-theorem.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/bmi.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/building-performance.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/clinical-care.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/collatz.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/complex.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/control-system.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/delfour.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/earthquake-epicenter.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/eco-route.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/euclid-infinitude.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/euler-identity.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/exoplanet-transit.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/faltings-theorem.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/fibonacci.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/fundamental-theorem-arithmetic.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/godel-numbering.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/gps-bike.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/gps-clinical-bench.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/graph-french.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/grass-molecular.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/group-theory.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/health-info.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/kaprekar-constant.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/lee.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/linked-lists.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/lldm.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/matrix-multiplication.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/matrix.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/newton-raphson.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/peano-factorial.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/pi.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/polynomial.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/prime.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/pythagorean-theorem.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/rest-path.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/roots-of-unity.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/turing.html +0 -0
- /package/{follows-from/artifacts → arctifacts}/wind-turbines.html +0 -0
package/lib/rdfjs.js
ADDED
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eyeling Reasoner — RDF/JS compatibility helpers
|
|
3
|
+
*
|
|
4
|
+
* A lightweight RDF/JS DataFactory plus adapters between Eyeling's internal
|
|
5
|
+
* N3 term model and RDF/JS terms/quads.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
XSD_NS,
|
|
12
|
+
Literal: InternalLiteral,
|
|
13
|
+
Iri,
|
|
14
|
+
Blank,
|
|
15
|
+
Var,
|
|
16
|
+
ListTerm,
|
|
17
|
+
OpenListTerm,
|
|
18
|
+
GraphTerm,
|
|
19
|
+
Triple,
|
|
20
|
+
Rule,
|
|
21
|
+
PrefixEnv,
|
|
22
|
+
literalParts,
|
|
23
|
+
} = require('./prelude');
|
|
24
|
+
const { termToN3, tripleToN3 } = require('./printing');
|
|
25
|
+
|
|
26
|
+
function isObject(value) {
|
|
27
|
+
return value != null && typeof value === 'object';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isIterable(value) {
|
|
31
|
+
return value != null && typeof value[Symbol.iterator] === 'function';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isAsyncIterable(value) {
|
|
35
|
+
return value != null && typeof value[Symbol.asyncIterator] === 'function';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getTypeTag(value) {
|
|
39
|
+
if (!isObject(value)) return '';
|
|
40
|
+
if (typeof value._type === 'string' && value._type) return value._type;
|
|
41
|
+
if (value.constructor && typeof value.constructor.name === 'string' && value.constructor.name)
|
|
42
|
+
return value.constructor.name;
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function isRdfJsTerm(value) {
|
|
47
|
+
return isObject(value) && typeof value.termType === 'string' && typeof value.value === 'string';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isRdfJsQuad(value) {
|
|
51
|
+
return (
|
|
52
|
+
isObject(value) &&
|
|
53
|
+
value.termType === 'Quad' &&
|
|
54
|
+
isRdfJsTerm(value.subject) &&
|
|
55
|
+
isRdfJsTerm(value.predicate) &&
|
|
56
|
+
isRdfJsTerm(value.object) &&
|
|
57
|
+
isRdfJsTerm(value.graph)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isEyelingPrefixEnvLike(value) {
|
|
62
|
+
if (value instanceof PrefixEnv) return true;
|
|
63
|
+
return isObject(value) && (getTypeTag(value) === 'PrefixEnv' || (isObject(value.map) && 'baseIri' in value));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function isEyelingTripleLike(value) {
|
|
67
|
+
if (value instanceof Triple) return true;
|
|
68
|
+
return isObject(value) && (getTypeTag(value) === 'Triple' || ('s' in value && 'p' in value && 'o' in value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isEyelingRuleLike(value) {
|
|
72
|
+
if (value instanceof Rule) return true;
|
|
73
|
+
return (
|
|
74
|
+
isObject(value) &&
|
|
75
|
+
(getTypeTag(value) === 'Rule' || (Array.isArray(value.premise) && Array.isArray(value.conclusion)))
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isEyelingAstBundleLike(value) {
|
|
80
|
+
return (
|
|
81
|
+
Array.isArray(value) &&
|
|
82
|
+
value.length >= 4 &&
|
|
83
|
+
value.length <= 5 &&
|
|
84
|
+
(value[0] == null || isEyelingPrefixEnvLike(value[0])) &&
|
|
85
|
+
Array.isArray(value[1]) &&
|
|
86
|
+
Array.isArray(value[2]) &&
|
|
87
|
+
Array.isArray(value[3])
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function termEquals(self, other) {
|
|
92
|
+
if (!other || typeof other !== 'object') return false;
|
|
93
|
+
if (self.termType !== other.termType) return false;
|
|
94
|
+
if (self.value !== other.value) return false;
|
|
95
|
+
|
|
96
|
+
if (self.termType === 'Literal') {
|
|
97
|
+
return (
|
|
98
|
+
!!self.datatype &&
|
|
99
|
+
typeof self.datatype.equals === 'function' &&
|
|
100
|
+
self.datatype.equals(other.datatype) &&
|
|
101
|
+
self.language === (other.language || '')
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (self.termType === 'Quad') {
|
|
106
|
+
return (
|
|
107
|
+
self.subject.equals(other.subject) &&
|
|
108
|
+
self.predicate.equals(other.predicate) &&
|
|
109
|
+
self.object.equals(other.object) &&
|
|
110
|
+
self.graph.equals(other.graph)
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class NamedNode {
|
|
118
|
+
constructor(value) {
|
|
119
|
+
this.termType = 'NamedNode';
|
|
120
|
+
this.value = String(value);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
equals(other) {
|
|
124
|
+
return termEquals(this, other);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
class BlankNode {
|
|
129
|
+
constructor(value) {
|
|
130
|
+
this.termType = 'BlankNode';
|
|
131
|
+
this.value = String(value);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
equals(other) {
|
|
135
|
+
return termEquals(this, other);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
class Variable {
|
|
140
|
+
constructor(value) {
|
|
141
|
+
this.termType = 'Variable';
|
|
142
|
+
this.value = String(value);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
equals(other) {
|
|
146
|
+
return termEquals(this, other);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
class DefaultGraph {
|
|
151
|
+
constructor() {
|
|
152
|
+
this.termType = 'DefaultGraph';
|
|
153
|
+
this.value = '';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
equals(other) {
|
|
157
|
+
return termEquals(this, other);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
class Literal {
|
|
162
|
+
constructor(value, languageOrDatatype) {
|
|
163
|
+
this.termType = 'Literal';
|
|
164
|
+
this.value = String(value);
|
|
165
|
+
this.language = '';
|
|
166
|
+
this.datatype = null;
|
|
167
|
+
|
|
168
|
+
if (typeof languageOrDatatype === 'string') {
|
|
169
|
+
this.language = languageOrDatatype;
|
|
170
|
+
this.datatype = new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString');
|
|
171
|
+
} else if (isRdfJsTerm(languageOrDatatype)) {
|
|
172
|
+
this.datatype = languageOrDatatype;
|
|
173
|
+
} else {
|
|
174
|
+
this.datatype = new NamedNode(XSD_NS + 'string');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
equals(other) {
|
|
179
|
+
return termEquals(this, other);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class Quad {
|
|
184
|
+
constructor(subject, predicate, object, graph) {
|
|
185
|
+
this.termType = 'Quad';
|
|
186
|
+
this.value = '';
|
|
187
|
+
this.subject = subject;
|
|
188
|
+
this.predicate = predicate;
|
|
189
|
+
this.object = object;
|
|
190
|
+
this.graph = graph || new DefaultGraph();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
equals(other) {
|
|
194
|
+
return termEquals(this, other);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const defaultGraphSingleton = new DefaultGraph();
|
|
199
|
+
|
|
200
|
+
const dataFactory = {
|
|
201
|
+
namedNode(value) {
|
|
202
|
+
return new NamedNode(value);
|
|
203
|
+
},
|
|
204
|
+
blankNode(value) {
|
|
205
|
+
return new BlankNode(value == null ? '' : value);
|
|
206
|
+
},
|
|
207
|
+
literal(value, languageOrDatatype) {
|
|
208
|
+
return new Literal(value, languageOrDatatype);
|
|
209
|
+
},
|
|
210
|
+
variable(value) {
|
|
211
|
+
return new Variable(value);
|
|
212
|
+
},
|
|
213
|
+
defaultGraph() {
|
|
214
|
+
return defaultGraphSingleton;
|
|
215
|
+
},
|
|
216
|
+
quad(subject, predicate, object, graph) {
|
|
217
|
+
return new Quad(subject, predicate, object, graph || defaultGraphSingleton);
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
function getDataFactory(factory) {
|
|
222
|
+
return factory && typeof factory.quad === 'function' ? factory : dataFactory;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function getLiteralLexicalKind(value) {
|
|
226
|
+
if (typeof value !== 'string' || value.length === 0) return 'typed';
|
|
227
|
+
if (value === 'true' || value === 'false') return 'boolean';
|
|
228
|
+
if (/^[+-]?[0-9]+$/.test(value)) return 'integer';
|
|
229
|
+
if (/^[+-]?(?:[0-9]*\.[0-9]+|[0-9]+\.)$/.test(value)) return 'decimal';
|
|
230
|
+
if (/^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)[eE][+-]?[0-9]+$/.test(value)) return 'double';
|
|
231
|
+
return 'typed';
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function inferDatatypeForLexical(value) {
|
|
235
|
+
switch (getLiteralLexicalKind(value)) {
|
|
236
|
+
case 'boolean':
|
|
237
|
+
return XSD_NS + 'boolean';
|
|
238
|
+
case 'integer':
|
|
239
|
+
return XSD_NS + 'integer';
|
|
240
|
+
case 'decimal':
|
|
241
|
+
return XSD_NS + 'decimal';
|
|
242
|
+
case 'double':
|
|
243
|
+
return XSD_NS + 'double';
|
|
244
|
+
default:
|
|
245
|
+
return XSD_NS + 'string';
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function quotedLexicalToValue(lexical) {
|
|
250
|
+
if (typeof lexical !== 'string' || lexical.length < 2 || lexical[0] !== '"' || lexical[lexical.length - 1] !== '"') {
|
|
251
|
+
return lexical;
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
return JSON.parse(lexical);
|
|
255
|
+
} catch {
|
|
256
|
+
return lexical.slice(1, -1);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function splitLiteralLexAndLang(value) {
|
|
261
|
+
if (typeof value !== 'string') return { lexical: value, language: '' };
|
|
262
|
+
if (!(value.startsWith('"') && value.length >= 2)) return { lexical: value, language: '' };
|
|
263
|
+
const lastQuote = value.lastIndexOf('"');
|
|
264
|
+
if (lastQuote <= 0 || lastQuote >= value.length - 1 || value[lastQuote + 1] !== '@') {
|
|
265
|
+
return { lexical: value, language: '' };
|
|
266
|
+
}
|
|
267
|
+
const language = value.slice(lastQuote + 2);
|
|
268
|
+
if (!/^[A-Za-z]+(?:-[A-Za-z0-9]+)*$/.test(language)) {
|
|
269
|
+
return { lexical: value, language: '' };
|
|
270
|
+
}
|
|
271
|
+
return { lexical: value.slice(0, lastQuote + 1), language };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function internalLiteralToRdfJs(term, factory) {
|
|
275
|
+
const rdfFactory = getDataFactory(factory);
|
|
276
|
+
const [lexicalWithMaybeLang, datatypeIri] = literalParts(term.value);
|
|
277
|
+
const { lexical, language } = splitLiteralLexAndLang(lexicalWithMaybeLang);
|
|
278
|
+
const isQuotedLexical =
|
|
279
|
+
typeof lexical === 'string' && lexical.length >= 2 && lexical[0] === '"' && lexical[lexical.length - 1] === '"';
|
|
280
|
+
const value = isQuotedLexical ? quotedLexicalToValue(lexical) : lexical;
|
|
281
|
+
|
|
282
|
+
if (language) return rdfFactory.literal(value, language);
|
|
283
|
+
if (datatypeIri) return rdfFactory.literal(value, rdfFactory.namedNode(datatypeIri));
|
|
284
|
+
return rdfFactory.literal(value, rdfFactory.namedNode(inferDatatypeForLexical(lexical)));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function unsupportedRdfJsTerm(term, position) {
|
|
288
|
+
const kind = term && term.constructor && term.constructor.name ? term.constructor.name : typeof term;
|
|
289
|
+
const where = position ? ` in ${position}` : '';
|
|
290
|
+
throw new TypeError(`Cannot convert N3-only term ${kind}${where} to RDF/JS`);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function internalTermToRdfJs(term, factory, position) {
|
|
294
|
+
const rdfFactory = getDataFactory(factory);
|
|
295
|
+
if (term instanceof Iri) return rdfFactory.namedNode(term.value);
|
|
296
|
+
if (term instanceof Blank) {
|
|
297
|
+
const label = typeof term.label === 'string' && term.label.startsWith('_:') ? term.label.slice(2) : term.label;
|
|
298
|
+
return rdfFactory.blankNode(label);
|
|
299
|
+
}
|
|
300
|
+
if (term instanceof Var) return rdfFactory.variable(term.name);
|
|
301
|
+
if (term instanceof InternalLiteral) return internalLiteralToRdfJs(term, rdfFactory);
|
|
302
|
+
return unsupportedRdfJsTerm(term, position);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function internalTripleToRdfJsQuad(triple, factory) {
|
|
306
|
+
const rdfFactory = getDataFactory(factory);
|
|
307
|
+
return rdfFactory.quad(
|
|
308
|
+
internalTermToRdfJs(triple.s, rdfFactory, 'subject'),
|
|
309
|
+
internalTermToRdfJs(triple.p, rdfFactory, 'predicate'),
|
|
310
|
+
internalTermToRdfJs(triple.o, rdfFactory, 'object'),
|
|
311
|
+
rdfFactory.defaultGraph(),
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function escapeStringForN3(value) {
|
|
316
|
+
return JSON.stringify(String(value));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function assertSupportedRdfJsTerm(term, position) {
|
|
320
|
+
if (!isRdfJsTerm(term)) {
|
|
321
|
+
throw new TypeError(`Expected an RDF/JS term in ${position}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function rdfJsTermToN3(term, position = 'term') {
|
|
326
|
+
assertSupportedRdfJsTerm(term, position);
|
|
327
|
+
|
|
328
|
+
switch (term.termType) {
|
|
329
|
+
case 'NamedNode':
|
|
330
|
+
return `<${term.value}>`;
|
|
331
|
+
case 'BlankNode':
|
|
332
|
+
return `_:${term.value}`;
|
|
333
|
+
case 'Variable':
|
|
334
|
+
return `?${term.value}`;
|
|
335
|
+
case 'DefaultGraph':
|
|
336
|
+
throw new TypeError(`DefaultGraph is not a valid standalone N3 term in ${position}`);
|
|
337
|
+
case 'Literal': {
|
|
338
|
+
const lang = typeof term.language === 'string' ? term.language : '';
|
|
339
|
+
const datatype = term.datatype && term.datatype.termType === 'NamedNode' ? term.datatype.value : null;
|
|
340
|
+
const lexical = escapeStringForN3(term.value);
|
|
341
|
+
if (lang) return `${lexical}@${lang}`;
|
|
342
|
+
if (!datatype || datatype === XSD_NS + 'string') return lexical;
|
|
343
|
+
return `${lexical}^^<${datatype}>`;
|
|
344
|
+
}
|
|
345
|
+
case 'Quad':
|
|
346
|
+
throw new TypeError(`Quoted triple terms are not supported in ${position}`);
|
|
347
|
+
default:
|
|
348
|
+
throw new TypeError(`Unsupported RDF/JS termType ${JSON.stringify(term.termType)} in ${position}`);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function rdfJsTermToInternal(term, position = 'term') {
|
|
353
|
+
assertSupportedRdfJsTerm(term, position);
|
|
354
|
+
|
|
355
|
+
switch (term.termType) {
|
|
356
|
+
case 'NamedNode':
|
|
357
|
+
return new Iri(term.value);
|
|
358
|
+
case 'BlankNode':
|
|
359
|
+
return new Blank(`_:${term.value}`);
|
|
360
|
+
case 'Variable':
|
|
361
|
+
return new Var(term.value);
|
|
362
|
+
case 'Literal':
|
|
363
|
+
return new InternalLiteral(rdfJsTermToN3(term, position));
|
|
364
|
+
case 'DefaultGraph':
|
|
365
|
+
throw new TypeError(`DefaultGraph is not a valid standalone N3 term in ${position}`);
|
|
366
|
+
case 'Quad':
|
|
367
|
+
throw new TypeError(`Quoted triple terms are not supported in ${position}`);
|
|
368
|
+
default:
|
|
369
|
+
throw new TypeError(`Unsupported RDF/JS termType ${JSON.stringify(term.termType)} in ${position}`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function rdfJsQuadToInternalTriple(quad) {
|
|
374
|
+
if (!isRdfJsQuad(quad)) throw new TypeError('Expected an RDF/JS Quad');
|
|
375
|
+
if (quad.graph.termType !== 'DefaultGraph') {
|
|
376
|
+
throw new TypeError('Named graph quads are not supported by Eyeling input; use the default graph only');
|
|
377
|
+
}
|
|
378
|
+
return new Triple(
|
|
379
|
+
rdfJsTermToInternal(quad.subject, 'quad.subject'),
|
|
380
|
+
rdfJsTermToInternal(quad.predicate, 'quad.predicate'),
|
|
381
|
+
rdfJsTermToInternal(quad.object, 'quad.object'),
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function rdfJsQuadToN3(quad) {
|
|
386
|
+
if (!isRdfJsQuad(quad)) throw new TypeError('Expected an RDF/JS Quad');
|
|
387
|
+
if (quad.graph.termType !== 'DefaultGraph') {
|
|
388
|
+
throw new TypeError('Named graph quads are not supported by Eyeling input; use the default graph only');
|
|
389
|
+
}
|
|
390
|
+
return `${rdfJsTermToN3(quad.subject, 'quad.subject')} ${rdfJsTermToN3(quad.predicate, 'quad.predicate')} ${rdfJsTermToN3(quad.object, 'quad.object')}.`;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function collectIterableToArray(iterable, label) {
|
|
394
|
+
if (!isIterable(iterable)) throw new TypeError(`${label} must be an iterable of RDF/JS quads`);
|
|
395
|
+
return Array.from(iterable);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
async function collectAsyncIterableToArray(iterable, label) {
|
|
399
|
+
if (isIterable(iterable)) return Array.from(iterable);
|
|
400
|
+
if (!isAsyncIterable(iterable)) throw new TypeError(`${label} must be an iterable or async iterable of RDF/JS quads`);
|
|
401
|
+
const out = [];
|
|
402
|
+
for await (const item of iterable) out.push(item);
|
|
403
|
+
return out;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function pickInputQuadIterable(input) {
|
|
407
|
+
if (!isObject(input)) return null;
|
|
408
|
+
if (input.quads != null) return { value: input.quads, label: 'input.quads' };
|
|
409
|
+
if (input.dataset != null) return { value: input.dataset, label: 'input.dataset' };
|
|
410
|
+
if (input.facts != null) return { value: input.facts, label: 'input.facts' };
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function getRulesText(input) {
|
|
415
|
+
if (!isObject(input)) return '';
|
|
416
|
+
return '';
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function getFactsText(input) {
|
|
420
|
+
if (!isObject(input)) return '';
|
|
421
|
+
for (const key of ['factsN3', 'n3Facts']) {
|
|
422
|
+
if (typeof input[key] === 'string') return input[key];
|
|
423
|
+
}
|
|
424
|
+
return '';
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function getPrefixesText(input) {
|
|
428
|
+
if (!isObject(input)) return '';
|
|
429
|
+
for (const key of ['prefixesN3', 'n3Prefixes']) {
|
|
430
|
+
if (typeof input[key] === 'string') return input[key];
|
|
431
|
+
}
|
|
432
|
+
return '';
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function joinN3Sections(parts) {
|
|
436
|
+
return parts
|
|
437
|
+
.filter((part) => typeof part === 'string' && part.length > 0)
|
|
438
|
+
.map((part) => (part.endsWith('\n') ? part : part + '\n'))
|
|
439
|
+
.join('');
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function reviveHeadBlankLabels(value) {
|
|
443
|
+
if (value instanceof Set) return new Set(value);
|
|
444
|
+
if (Array.isArray(value)) return new Set(value.map((item) => String(item)));
|
|
445
|
+
return new Set();
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function reviveEyelingTerm(value) {
|
|
449
|
+
if (value instanceof Iri || value instanceof InternalLiteral || value instanceof Var || value instanceof Blank)
|
|
450
|
+
return value;
|
|
451
|
+
if (value instanceof ListTerm || value instanceof OpenListTerm || value instanceof GraphTerm) return value;
|
|
452
|
+
|
|
453
|
+
const tag = getTypeTag(value);
|
|
454
|
+
|
|
455
|
+
switch (tag) {
|
|
456
|
+
case 'Iri':
|
|
457
|
+
return new Iri(value.value);
|
|
458
|
+
case 'Literal':
|
|
459
|
+
return new InternalLiteral(value.value);
|
|
460
|
+
case 'Var':
|
|
461
|
+
return new Var(value.name);
|
|
462
|
+
case 'Blank':
|
|
463
|
+
return new Blank(value.label);
|
|
464
|
+
case 'ListTerm':
|
|
465
|
+
return new ListTerm((value.elems || []).map((item) => reviveEyelingTerm(item)));
|
|
466
|
+
case 'OpenListTerm':
|
|
467
|
+
return new OpenListTerm(
|
|
468
|
+
(value.prefix || []).map((item) => reviveEyelingTerm(item)),
|
|
469
|
+
value.tailVar,
|
|
470
|
+
);
|
|
471
|
+
case 'GraphTerm':
|
|
472
|
+
return new GraphTerm((value.triples || []).map((item) => reviveEyelingTriple(item)));
|
|
473
|
+
default:
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
if (isRdfJsTerm(value)) return rdfJsTermToInternal(value);
|
|
478
|
+
throw new TypeError(`Unsupported Eyeling term object: ${JSON.stringify(tag || value)}`);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function reviveEyelingTriple(value) {
|
|
482
|
+
if (value instanceof Triple) return value;
|
|
483
|
+
if (!isEyelingTripleLike(value)) throw new TypeError('Expected an Eyeling Triple-like object');
|
|
484
|
+
return new Triple(reviveEyelingTerm(value.s), reviveEyelingTerm(value.p), reviveEyelingTerm(value.o));
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function reviveEyelingRule(value) {
|
|
488
|
+
if (value instanceof Rule) return value;
|
|
489
|
+
if (!isEyelingRuleLike(value)) throw new TypeError('Expected an Eyeling Rule-like object');
|
|
490
|
+
|
|
491
|
+
const rule = new Rule(
|
|
492
|
+
(value.premise || []).map((item) => reviveEyelingTriple(item)),
|
|
493
|
+
(value.conclusion || []).map((item) => reviveEyelingTriple(item)),
|
|
494
|
+
value.isForward !== false,
|
|
495
|
+
!!value.isFuse,
|
|
496
|
+
reviveHeadBlankLabels(value.headBlankLabels),
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
if (value.__dynamicConclusionTerm != null) {
|
|
500
|
+
Object.defineProperty(rule, '__dynamicConclusionTerm', {
|
|
501
|
+
value: reviveEyelingTerm(value.__dynamicConclusionTerm),
|
|
502
|
+
enumerable: false,
|
|
503
|
+
writable: false,
|
|
504
|
+
configurable: true,
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
return rule;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
function revivePrefixEnv(value) {
|
|
512
|
+
if (value instanceof PrefixEnv) return value;
|
|
513
|
+
if (!isEyelingPrefixEnvLike(value)) return PrefixEnv.newDefault();
|
|
514
|
+
return new PrefixEnv({ ...(value.map || {}) }, value.baseIri || '');
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function reviveRuleArray(value, label) {
|
|
518
|
+
if (value == null) return [];
|
|
519
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array of Eyeling Rule objects`);
|
|
520
|
+
return value.map((item) => reviveEyelingRule(item));
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function reviveTripleArray(value, label) {
|
|
524
|
+
if (value == null) return [];
|
|
525
|
+
if (!Array.isArray(value)) throw new TypeError(`${label} must be an array of Eyeling Triple objects`);
|
|
526
|
+
return value.map((item) => reviveEyelingTriple(item));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
function serializePrefixEnv(prefixes) {
|
|
530
|
+
const pref = revivePrefixEnv(prefixes);
|
|
531
|
+
const out = [];
|
|
532
|
+
|
|
533
|
+
if (pref.baseIri) out.push(`@base <${pref.baseIri}> .`);
|
|
534
|
+
|
|
535
|
+
for (const [name, iri] of Object.entries(pref.map || {})) {
|
|
536
|
+
if (!iri) continue;
|
|
537
|
+
out.push(`@prefix ${name ? `${name}:` : ':'} <${iri}> .`);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
return out.join('\n');
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function serializeFormulaTriples(triples, prefixes) {
|
|
544
|
+
if (!Array.isArray(triples) || triples.length === 0) return '{ }';
|
|
545
|
+
return `{
|
|
546
|
+
${triples.map((tr) => ` ${tripleToN3(tr, prefixes)}`).join('\n')}
|
|
547
|
+
}`;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function serializeRuleHead(rule, prefixes) {
|
|
551
|
+
if (rule.isFuse) return 'false';
|
|
552
|
+
if (rule.__dynamicConclusionTerm) return termToN3(rule.__dynamicConclusionTerm, prefixes);
|
|
553
|
+
if (!Array.isArray(rule.conclusion) || rule.conclusion.length === 0) return 'true';
|
|
554
|
+
return serializeFormulaTriples(rule.conclusion, prefixes);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function serializeRulePremise(rule, prefixes) {
|
|
558
|
+
if (!Array.isArray(rule.premise) || rule.premise.length === 0) return 'true';
|
|
559
|
+
return serializeFormulaTriples(rule.premise, prefixes);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function serializeRule(rule, prefixes) {
|
|
563
|
+
if (rule.isForward === false) {
|
|
564
|
+
const head =
|
|
565
|
+
rule.conclusion && rule.conclusion.length ? serializeFormulaTriples(rule.conclusion, prefixes) : 'true';
|
|
566
|
+
return `${head} <= ${serializeRulePremise(rule, prefixes)} .`;
|
|
567
|
+
}
|
|
568
|
+
return `${serializeRulePremise(rule, prefixes)} => ${serializeRuleHead(rule, prefixes)} .`;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function serializeQueryRule(rule, prefixes) {
|
|
572
|
+
return `${serializeRulePremise(rule, prefixes)} log:query ${serializeRuleHead(rule, prefixes)} .`;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function serializeEyelingDocument(doc) {
|
|
576
|
+
const prefixes = revivePrefixEnv(doc.prefixes);
|
|
577
|
+
const prefixText = serializePrefixEnv(prefixes);
|
|
578
|
+
const tripleText = (doc.triples || []).map((tr) => tripleToN3(tr, prefixes)).join('\n');
|
|
579
|
+
const fruleText = (doc.frules || []).map((rule) => serializeRule(rule, prefixes)).join('\n');
|
|
580
|
+
const bruleText = (doc.brules || []).map((rule) => serializeRule(rule, prefixes)).join('\n');
|
|
581
|
+
const qruleText = (doc.logQueryRules || []).map((rule) => serializeQueryRule(rule, prefixes)).join('\n');
|
|
582
|
+
return joinN3Sections([prefixText, tripleText, fruleText, bruleText, qruleText]);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function parseAstBundle(bundle) {
|
|
586
|
+
if (!isEyelingAstBundleLike(bundle))
|
|
587
|
+
throw new TypeError('Expected an Eyeling AST bundle [prefixes, triples, forwardRules, backwardRules,? queryRules]');
|
|
588
|
+
return {
|
|
589
|
+
prefixes: revivePrefixEnv(bundle[0]),
|
|
590
|
+
triples: reviveTripleArray(bundle[1], 'ast[1]'),
|
|
591
|
+
frules: reviveRuleArray(bundle[2], 'ast[2]'),
|
|
592
|
+
brules: reviveRuleArray(bundle[3], 'ast[3]'),
|
|
593
|
+
logQueryRules: reviveRuleArray(bundle[4] || [], 'ast[4]'),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
function combineDocuments(base, extra) {
|
|
598
|
+
return {
|
|
599
|
+
prefixes: extra.prefixes || base.prefixes,
|
|
600
|
+
triples: base.triples.concat(extra.triples || []),
|
|
601
|
+
frules: base.frules.concat(extra.frules || []),
|
|
602
|
+
brules: base.brules.concat(extra.brules || []),
|
|
603
|
+
logQueryRules: base.logQueryRules.concat(extra.logQueryRules || []),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function emptyDocument() {
|
|
608
|
+
return {
|
|
609
|
+
prefixes: PrefixEnv.newDefault(),
|
|
610
|
+
triples: [],
|
|
611
|
+
frules: [],
|
|
612
|
+
brules: [],
|
|
613
|
+
logQueryRules: [],
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function hasEyelingObjectInput(input) {
|
|
618
|
+
if (isEyelingAstBundleLike(input)) return true;
|
|
619
|
+
if (!isObject(input)) return false;
|
|
620
|
+
if (
|
|
621
|
+
isEyelingAstBundleLike(input.ast) ||
|
|
622
|
+
isEyelingAstBundleLike(input.document) ||
|
|
623
|
+
isEyelingAstBundleLike(input.rules)
|
|
624
|
+
)
|
|
625
|
+
return true;
|
|
626
|
+
if (isEyelingPrefixEnvLike(input.prefixes)) return true;
|
|
627
|
+
if (Array.isArray(input.triples) || Array.isArray(input.forwardRules) || Array.isArray(input.frules)) return true;
|
|
628
|
+
if (Array.isArray(input.backwardRules) || Array.isArray(input.brules)) return true;
|
|
629
|
+
if (Array.isArray(input.queryRules) || Array.isArray(input.logQueryRules) || Array.isArray(input.qrules)) return true;
|
|
630
|
+
if (Array.isArray(input.rules) && input.rules.some((item) => isEyelingRuleLike(item))) return true;
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function parseEyelingDocumentBase(input) {
|
|
635
|
+
if (isEyelingAstBundleLike(input)) return parseAstBundle(input);
|
|
636
|
+
if (!isObject(input)) return null;
|
|
637
|
+
|
|
638
|
+
let doc = emptyDocument();
|
|
639
|
+
let found = false;
|
|
640
|
+
|
|
641
|
+
const embeddedAst = input.ast || input.document;
|
|
642
|
+
if (isEyelingAstBundleLike(embeddedAst)) {
|
|
643
|
+
doc = combineDocuments(doc, parseAstBundle(embeddedAst));
|
|
644
|
+
found = true;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
if (isEyelingAstBundleLike(input.rules)) {
|
|
648
|
+
doc = combineDocuments(doc, parseAstBundle(input.rules));
|
|
649
|
+
found = true;
|
|
650
|
+
} else if (Array.isArray(input.rules) && input.rules.some((item) => isEyelingRuleLike(item))) {
|
|
651
|
+
doc.frules = doc.frules.concat(reviveRuleArray(input.rules, 'input.rules'));
|
|
652
|
+
found = true;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (isEyelingPrefixEnvLike(input.prefixes)) {
|
|
656
|
+
doc.prefixes = revivePrefixEnv(input.prefixes);
|
|
657
|
+
found = true;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
if (Array.isArray(input.triples)) {
|
|
661
|
+
doc.triples = doc.triples.concat(reviveTripleArray(input.triples, 'input.triples'));
|
|
662
|
+
found = true;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (Array.isArray(input.forwardRules)) {
|
|
666
|
+
doc.frules = doc.frules.concat(reviveRuleArray(input.forwardRules, 'input.forwardRules'));
|
|
667
|
+
found = true;
|
|
668
|
+
}
|
|
669
|
+
if (Array.isArray(input.frules)) {
|
|
670
|
+
doc.frules = doc.frules.concat(reviveRuleArray(input.frules, 'input.frules'));
|
|
671
|
+
found = true;
|
|
672
|
+
}
|
|
673
|
+
if (Array.isArray(input.backwardRules)) {
|
|
674
|
+
doc.brules = doc.brules.concat(reviveRuleArray(input.backwardRules, 'input.backwardRules'));
|
|
675
|
+
found = true;
|
|
676
|
+
}
|
|
677
|
+
if (Array.isArray(input.brules)) {
|
|
678
|
+
doc.brules = doc.brules.concat(reviveRuleArray(input.brules, 'input.brules'));
|
|
679
|
+
found = true;
|
|
680
|
+
}
|
|
681
|
+
if (Array.isArray(input.queryRules)) {
|
|
682
|
+
doc.logQueryRules = doc.logQueryRules.concat(reviveRuleArray(input.queryRules, 'input.queryRules'));
|
|
683
|
+
found = true;
|
|
684
|
+
}
|
|
685
|
+
if (Array.isArray(input.logQueryRules)) {
|
|
686
|
+
doc.logQueryRules = doc.logQueryRules.concat(reviveRuleArray(input.logQueryRules, 'input.logQueryRules'));
|
|
687
|
+
found = true;
|
|
688
|
+
}
|
|
689
|
+
if (Array.isArray(input.qrules)) {
|
|
690
|
+
doc.logQueryRules = doc.logQueryRules.concat(reviveRuleArray(input.qrules, 'input.qrules'));
|
|
691
|
+
found = true;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
return found ? doc : null;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
function appendSyncQuadFacts(doc, input) {
|
|
698
|
+
const quadsInfo = pickInputQuadIterable(input);
|
|
699
|
+
if (!quadsInfo) return doc;
|
|
700
|
+
const quads = collectIterableToArray(quadsInfo.value, quadsInfo.label);
|
|
701
|
+
return {
|
|
702
|
+
...doc,
|
|
703
|
+
triples: doc.triples.concat(quads.map((quad) => rdfJsQuadToInternalTriple(quad))),
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
async function appendAsyncQuadFacts(doc, input) {
|
|
708
|
+
const quadsInfo = pickInputQuadIterable(input);
|
|
709
|
+
if (!quadsInfo) return doc;
|
|
710
|
+
const quads = await collectAsyncIterableToArray(quadsInfo.value, quadsInfo.label);
|
|
711
|
+
return {
|
|
712
|
+
...doc,
|
|
713
|
+
triples: doc.triples.concat(quads.map((quad) => rdfJsQuadToInternalTriple(quad))),
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function normalizeParsedReasonerInputSync(input) {
|
|
718
|
+
const baseDoc = parseEyelingDocumentBase(input);
|
|
719
|
+
if (!baseDoc) return null;
|
|
720
|
+
return appendSyncQuadFacts(baseDoc, input);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
async function normalizeParsedReasonerInputAsync(input) {
|
|
724
|
+
const baseDoc = parseEyelingDocumentBase(input);
|
|
725
|
+
if (!baseDoc) return null;
|
|
726
|
+
return appendAsyncQuadFacts(baseDoc, input);
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function normalizeReasonerInputSync(input) {
|
|
730
|
+
if (typeof input === 'string') return input;
|
|
731
|
+
const parsed = normalizeParsedReasonerInputSync(input);
|
|
732
|
+
if (parsed) return serializeEyelingDocument(parsed);
|
|
733
|
+
if (!isObject(input)) {
|
|
734
|
+
throw new TypeError(
|
|
735
|
+
'Reasoner input must be an N3 string, an Eyeling AST/rule object, or an object containing RDF/JS quads plus optional rules',
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
if (typeof input.n3 === 'string') return input.n3;
|
|
739
|
+
|
|
740
|
+
const quadsInfo = pickInputQuadIterable(input);
|
|
741
|
+
const rulesText = getRulesText(input);
|
|
742
|
+
const factsText = getFactsText(input);
|
|
743
|
+
const prefixesText = getPrefixesText(input);
|
|
744
|
+
|
|
745
|
+
if (!quadsInfo) {
|
|
746
|
+
if (rulesText || factsText || prefixesText) return joinN3Sections([prefixesText, factsText, rulesText]);
|
|
747
|
+
throw new TypeError('Input object must provide n3 text, Eyeling AST/rule objects, or RDF/JS quads/facts/dataset');
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const quads = collectIterableToArray(quadsInfo.value, quadsInfo.label);
|
|
751
|
+
const quadText = quads.map((quad) => rdfJsQuadToN3(quad)).join('\n');
|
|
752
|
+
return joinN3Sections([prefixesText, factsText, quadText, rulesText]);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
async function normalizeReasonerInputAsync(input) {
|
|
756
|
+
if (typeof input === 'string') return input;
|
|
757
|
+
const parsed = await normalizeParsedReasonerInputAsync(input);
|
|
758
|
+
if (parsed) return serializeEyelingDocument(parsed);
|
|
759
|
+
if (!isObject(input)) {
|
|
760
|
+
throw new TypeError(
|
|
761
|
+
'Reasoner input must be an N3 string, an Eyeling AST/rule object, or an object containing RDF/JS quads plus optional rules',
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
if (typeof input.n3 === 'string') return input.n3;
|
|
765
|
+
|
|
766
|
+
const quadsInfo = pickInputQuadIterable(input);
|
|
767
|
+
const rulesText = getRulesText(input);
|
|
768
|
+
const factsText = getFactsText(input);
|
|
769
|
+
const prefixesText = getPrefixesText(input);
|
|
770
|
+
|
|
771
|
+
if (!quadsInfo) {
|
|
772
|
+
if (rulesText || factsText || prefixesText) return joinN3Sections([prefixesText, factsText, rulesText]);
|
|
773
|
+
throw new TypeError('Input object must provide n3 text, Eyeling AST/rule objects, or RDF/JS quads/facts/dataset');
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const quads = await collectAsyncIterableToArray(quadsInfo.value, quadsInfo.label);
|
|
777
|
+
const quadText = quads.map((quad) => rdfJsQuadToN3(quad)).join('\n');
|
|
778
|
+
return joinN3Sections([prefixesText, factsText, quadText, rulesText]);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
module.exports = {
|
|
782
|
+
dataFactory,
|
|
783
|
+
getDataFactory,
|
|
784
|
+
isRdfJsTerm,
|
|
785
|
+
isRdfJsQuad,
|
|
786
|
+
rdfJsTermToN3,
|
|
787
|
+
rdfJsQuadToN3,
|
|
788
|
+
rdfJsQuadToInternalTriple,
|
|
789
|
+
internalTermToRdfJs,
|
|
790
|
+
internalTripleToRdfJsQuad,
|
|
791
|
+
normalizeParsedReasonerInputSync,
|
|
792
|
+
normalizeReasonerInputSync,
|
|
793
|
+
normalizeReasonerInputAsync,
|
|
794
|
+
hasEyelingObjectInput,
|
|
795
|
+
};
|