eyereasoner 2.15.0 → 3.0.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/README.md +2 -19
- package/dist/bin/index.js +3 -18
- package/dist/bin/main.d.ts +2 -0
- package/dist/bin/main.js +21 -0
- package/dist/eye.d.ts +1 -1
- package/dist/eye.js +1 -1
- package/dist/index.d.ts +0 -38
- package/dist/index.js +1 -10
- package/dist/query.js +3 -1
- package/dist/strToBuffer.js +1 -0
- package/dist/swipl-bundled.temp.d.ts +3 -1
- package/dist/swipl-bundled.temp.js +1 -4
- package/dist/transformers.d.ts +46 -26
- package/dist/transformers.js +60 -42
- package/package.json +18 -7
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Distributing the [EYE](https://github.com/eyereasoner/eye) reasoner for browser
|
|
|
9
9
|
|
|
10
10
|
## Usage
|
|
11
11
|
|
|
12
|
-
The simplest way to use this package is to use the `n3reasoner` to execute a query over a dataset and get the results. The input `data` should include the data and any inference rules that you wish to apply to the dataset; the optional `query` should match the pattern of data you wish the engine to return; if left undefined, all inferred facts will be returned. For example:
|
|
12
|
+
The simplest way to use this package is to use the `n3reasoner` to execute a query over a dataset and get the results. The input `data` should include the data and any inference rules that you wish to apply to the dataset; the optional `query` should match the pattern of data you wish the engine to return; if left undefined, all new inferred facts will be returned. For example:
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
15
|
import { n3reasoner } from 'eyereasoner';
|
|
@@ -72,8 +72,7 @@ const result = await n3reasoner(data, undefined, {
|
|
|
72
72
|
|
|
73
73
|
The `options` parameter can be used to configure the reasoning process. The following options are available:
|
|
74
74
|
- `output`: What to output with implicit queries.
|
|
75
|
-
-
|
|
76
|
-
- `derivations`: output only new derived triples, a.k.a `--pass-only-new`
|
|
75
|
+
- `derivations`: output only new derived triples, a.k.a `--pass-only-new` (default)
|
|
77
76
|
- `deductive_closure`: output deductive closure, a.k.a `--pass`
|
|
78
77
|
- `deductive_closure_plus_rules`: output deductive closure plus rules, a.k.a `--pass-all`
|
|
79
78
|
- `grounded_deductive_closure_plus_rules`: ground the rules and output deductive closure plus rules, a.k.a `--pass-all-ground`
|
|
@@ -210,22 +209,6 @@ We provide some examples of using `eyereasoner`:
|
|
|
210
209
|
- Using as an npm package and bundling using webpack ([`./examples/rollup`](https://github.com/eyereasoner/eye-js/tree/main/examples/rollup)).
|
|
211
210
|
- Using a prebuilt version of `eyereasoner` ([`./examples/prebuilt`](https://github.com/eyereasoner/eye-js/tree/main/examples/prebuilt)) - this example is [deployed on github pages](https://eyereasoner.github.io/eye-js/example/index.html).
|
|
212
211
|
|
|
213
|
-
## Other Notes
|
|
214
|
-
|
|
215
|
-
### `MaxListenersExceededWarning`
|
|
216
|
-
|
|
217
|
-
If you instantiate `SWIPL` more than 10 times in the same process, then you may see the warning:
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
(node:29436) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
this is caused by the fact that each instantiation of SWIPL adds a new listener to the global process. To fix this problem increase the maximum number of listeners allowed on the global process.
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
process.setMaxListeners(100)
|
|
227
|
-
```
|
|
228
|
-
|
|
229
212
|
## License
|
|
230
213
|
©2022–present
|
|
231
214
|
[Jesse Wright](https://github.com/jeswr),
|
package/dist/bin/index.js
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
const Module = await (0, __1.SwiplEye)();
|
|
12
|
-
// Make any local files available to the reasoner
|
|
13
|
-
for (const arg of process.argv.slice(2)) {
|
|
14
|
-
const p = path_1.default.join(process.cwd(), arg);
|
|
15
|
-
if (fs_1.default.existsSync(p)) {
|
|
16
|
-
Module.FS.writeFile(arg, fs_1.default.readFileSync(p));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
(0, __1.queryOnce)(Module, 'main', process.argv.slice(2));
|
|
20
|
-
}
|
|
21
|
-
main();
|
|
4
|
+
/* istanbul ignore file */
|
|
5
|
+
const main_1 = require("./main");
|
|
6
|
+
(0, main_1.mainFunc)(process);
|
package/dist/bin/main.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mainFunc = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const __1 = require("..");
|
|
10
|
+
async function mainFunc(proc) {
|
|
11
|
+
const Module = await (0, __1.SwiplEye)();
|
|
12
|
+
// Make any local files available to the reasoner
|
|
13
|
+
for (const arg of proc.argv.slice(2)) {
|
|
14
|
+
const p = path_1.default.join(proc.cwd(), arg);
|
|
15
|
+
if (fs_1.default.existsSync(p)) {
|
|
16
|
+
Module.FS.writeFile(arg, fs_1.default.readFileSync(p));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
(0, __1.queryOnce)(Module, 'main', proc.argv.slice(2));
|
|
20
|
+
}
|
|
21
|
+
exports.mainFunc = mainFunc;
|