eyereasoner 1.12.0 → 1.14.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 +24 -5
- package/dist/eye.pl.js +1 -1
- package/dist/eye.pvm.d.ts +2 -0
- package/dist/eye.pvm.js +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/strToBuffer.d.ts +8 -0
- package/dist/strToBuffer.js +41 -0
- package/dist/transformers.d.ts +11 -1
- package/dist/transformers.js +24 -3
- package/package.json +16 -13
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ const dataQuads = [
|
|
|
91
91
|
To have more granular control one can also use this module as follows
|
|
92
92
|
|
|
93
93
|
```ts
|
|
94
|
-
import {
|
|
94
|
+
import { SwiplEye, queryOnce } from 'eyereasoner';
|
|
95
95
|
|
|
96
96
|
const query = `
|
|
97
97
|
@prefix : <http://example.org/socrates#>.
|
|
@@ -111,10 +111,7 @@ const data = `
|
|
|
111
111
|
|
|
112
112
|
async function main() {
|
|
113
113
|
// Instantiate a new SWIPL module and log any results it produces to the console
|
|
114
|
-
const Module = await
|
|
115
|
-
|
|
116
|
-
// Load EYE into the SWIPL Module and run consule("eye.pl").
|
|
117
|
-
loadEye(Module)
|
|
114
|
+
const Module = await SwiplEye({ print: (str: string) => { console.log(str) }, arguments: ['-q'] });
|
|
118
115
|
|
|
119
116
|
// Load the the strings data and query as files data.n3 and query.n3 into the module
|
|
120
117
|
Module.FS.writeFile('data.n3', data);
|
|
@@ -134,6 +131,28 @@ isomorphic across browser and node without requiring any bundlers. Some users ma
|
|
|
134
131
|
over their SWIPL module; for instance in order to load the `.wasm` file separately for performance. In these cases
|
|
135
132
|
see the `SWIPL` modules exported by [npm swipl wasm](https://github.com/rla/npm-swipl-wasm/).
|
|
136
133
|
|
|
134
|
+
An example usage of the node-specific swipl-wasm build is as follows;
|
|
135
|
+
```ts
|
|
136
|
+
import { loadEyeImage, queryOnce } from 'eyereasoner';
|
|
137
|
+
import SWIPL from 'swipl-wasm/dist/swipl-node';
|
|
138
|
+
|
|
139
|
+
async function main() {
|
|
140
|
+
const SwiplEye = loadEyeImage();
|
|
141
|
+
|
|
142
|
+
// Instantiate a new SWIPL module and log any results it produces to the console
|
|
143
|
+
const Module = await SwiplEye({ print: (str: string) => { console.log(str) }, arguments: ['-q'] });
|
|
144
|
+
|
|
145
|
+
// Load the the strings data and query as files data.n3 and query.n3 into the module
|
|
146
|
+
Module.FS.writeFile('data.n3', data);
|
|
147
|
+
Module.FS.writeFile('query.n3', query);
|
|
148
|
+
|
|
149
|
+
// Execute main(['--nope', '--quiet', './data.n3', '--query', './query.n3']).
|
|
150
|
+
queryOnce(Module, 'main', ['--nope', '--quiet', './data.n3', '--query', './query.n3']);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
main();
|
|
154
|
+
```
|
|
155
|
+
|
|
137
156
|
## License
|
|
138
157
|
©2022–present
|
|
139
158
|
[Jesse Wright](https://github.com/jeswr),
|