eyereasoner 1.14.0 → 2.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/README.md CHANGED
@@ -15,12 +15,8 @@ The simplest way to use this package is to execute a query over a dataset and ge
15
15
  import { basicQuery } from 'eyereasoner';
16
16
 
17
17
  async function main() {
18
- const {
19
- // The result of the query (as an array of quads)
20
- result,
21
- // The proof of the results (as an array of quads)
22
- proof
23
- } = await basicQuery(dataQuads, queryQuads);
18
+ // The result of the query (as an array of quads)
19
+ const result = await basicQuery(dataQuads, queryQuads);
24
20
  }
25
21
 
26
22
  main();
@@ -131,13 +127,13 @@ isomorphic across browser and node without requiring any bundlers. Some users ma
131
127
  over their SWIPL module; for instance in order to load the `.wasm` file separately for performance. In these cases
132
128
  see the `SWIPL` modules exported by [npm swipl wasm](https://github.com/rla/npm-swipl-wasm/).
133
129
 
134
- An example usage of the node-specific swipl-wasm build is as follows;
130
+ An example usage of the node-specific swipl-wasm build is as follows:
135
131
  ```ts
136
132
  import { loadEyeImage, queryOnce } from 'eyereasoner';
137
133
  import SWIPL from 'swipl-wasm/dist/swipl-node';
138
134
 
139
135
  async function main() {
140
- const SwiplEye = loadEyeImage();
136
+ const SwiplEye = loadEyeImage(SWIPL);
141
137
 
142
138
  // Instantiate a new SWIPL module and log any results it produces to the console
143
139
  const Module = await SwiplEye({ print: (str: string) => { console.log(str) }, arguments: ['-q'] });
@@ -153,6 +149,14 @@ async function main() {
153
149
  main();
154
150
  ```
155
151
 
152
+ ## CLI Usage
153
+
154
+ Globally installing `eyereasoner` using `npm i -g eyereasoner` will also expose a CLI interface for using the reasoner:
155
+
156
+ ```bash
157
+ eyereasoner --nope --quiet ./socrates.n3 --query ./socrates-query.n3
158
+ ```
159
+
156
160
  ## License
157
161
  ©2022–present
158
162
  [Jesse Wright](https://github.com/jeswr),
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const path_1 = __importDefault(require("path"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const __1 = require("..");
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();