eyereasoner 1.8.0 → 1.9.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/query.d.ts +10 -0
- package/dist/query.js +21 -0
- package/dist/transformers.d.ts +10 -7
- package/dist/transformers.js +20 -19
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ exports.basicQuery = exports.SWIPL = void 0;
|
|
|
21
21
|
// @ts-ignore
|
|
22
22
|
const swipl_bundled_temp_1 = __importDefault(require("./swipl-bundled.temp"));
|
|
23
23
|
const transformers_1 = require("./transformers");
|
|
24
|
+
__exportStar(require("./query"), exports);
|
|
24
25
|
__exportStar(require("./transformers"), exports);
|
|
25
26
|
// @ts-ignore
|
|
26
27
|
var swipl_bundled_temp_2 = require("./swipl-bundled.temp");
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SWIPLModule } from 'swipl-wasm/dist/swipl/swipl';
|
|
2
|
+
/**
|
|
3
|
+
* Executes a query
|
|
4
|
+
* @param Module The module to execute the query on
|
|
5
|
+
* @param name The name of the query function
|
|
6
|
+
* @param args The arguments of the query function
|
|
7
|
+
* @returns The result of the query
|
|
8
|
+
*/
|
|
9
|
+
export declare function query(Module: SWIPLModule, name: string, args: string[] | string): import("swipl-wasm/dist/common").Query;
|
|
10
|
+
export declare function queryOnce(Module: SWIPLModule, name: string, args: string[] | string): unknown;
|
package/dist/query.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryOnce = exports.query = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Executes a query
|
|
6
|
+
* @param Module The module to execute the query on
|
|
7
|
+
* @param name The name of the query function
|
|
8
|
+
* @param args The arguments of the query function
|
|
9
|
+
* @returns The result of the query
|
|
10
|
+
*/
|
|
11
|
+
function query(Module, name, args) {
|
|
12
|
+
const queryString = `${name}(${typeof args === 'string'
|
|
13
|
+
? `"${args}"`
|
|
14
|
+
: `[${args.map((arg) => `'${arg}'`).join(', ')}]`}).`;
|
|
15
|
+
return Module.prolog.query(queryString);
|
|
16
|
+
}
|
|
17
|
+
exports.query = query;
|
|
18
|
+
function queryOnce(Module, name, args) {
|
|
19
|
+
return query(Module, name, args).once();
|
|
20
|
+
}
|
|
21
|
+
exports.queryOnce = queryOnce;
|
package/dist/transformers.d.ts
CHANGED
|
@@ -2,14 +2,17 @@ import type { SWIPLModule } from 'swipl-wasm/dist/swipl/swipl';
|
|
|
2
2
|
import type SWIPL from 'swipl-wasm/dist/swipl/swipl';
|
|
3
3
|
import { Quad } from '@rdfjs/types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @param Module
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
* Writes eye.pl to the Module
|
|
6
|
+
* @param Module A SWIPL Module
|
|
7
|
+
* @returns A SWIPL Module
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeEye(Module: SWIPLModule): SWIPLModule;
|
|
10
|
+
/**
|
|
11
|
+
* Consults the eye.pl Module
|
|
12
|
+
* @param Module A SWIPL Module
|
|
13
|
+
* @returns A SWIPL Module
|
|
10
14
|
*/
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function queryOnce(Module: SWIPLModule, name: string, args: string[] | string): unknown;
|
|
15
|
+
export declare function consultEye(Module: SWIPLModule): SWIPLModule;
|
|
13
16
|
/**
|
|
14
17
|
* A SWIPL transformer that loads and consults eye.pl in the
|
|
15
18
|
* given SWIPL module
|
package/dist/transformers.js
CHANGED
|
@@ -12,28 +12,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.executeBasicEyeQueryQuads = exports.executeBasicEyeQuery = exports.loadAndRunQuery = exports.runQuery = exports.loadEye = exports.
|
|
15
|
+
exports.executeBasicEyeQueryQuads = exports.executeBasicEyeQuery = exports.loadAndRunQuery = exports.runQuery = exports.loadEye = exports.consultEye = exports.writeEye = void 0;
|
|
16
16
|
const n3_1 = require("n3");
|
|
17
17
|
const n3Writer_temp_1 = require("./n3Writer.temp");
|
|
18
18
|
const eye_pl_1 = __importDefault(require("./eye.pl"));
|
|
19
|
+
const query_1 = require("./query");
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
-
* @param Module
|
|
22
|
-
* @
|
|
23
|
-
* @param args The arguments of the query function
|
|
24
|
-
* @returns The result of the query
|
|
21
|
+
* Writes eye.pl to the Module
|
|
22
|
+
* @param Module A SWIPL Module
|
|
23
|
+
* @returns A SWIPL Module
|
|
25
24
|
*/
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: `[${args.map((arg) => `'${arg}'`).join(', ')}]`}).`;
|
|
30
|
-
return Module.prolog.query(queryString);
|
|
25
|
+
function writeEye(Module) {
|
|
26
|
+
Module.FS.writeFile('eye.pl', eye_pl_1.default);
|
|
27
|
+
return Module;
|
|
31
28
|
}
|
|
32
|
-
exports.
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
exports.writeEye = writeEye;
|
|
30
|
+
/**
|
|
31
|
+
* Consults the eye.pl Module
|
|
32
|
+
* @param Module A SWIPL Module
|
|
33
|
+
* @returns A SWIPL Module
|
|
34
|
+
*/
|
|
35
|
+
function consultEye(Module) {
|
|
36
|
+
(0, query_1.queryOnce)(Module, 'consult', 'eye.pl');
|
|
37
|
+
return Module;
|
|
35
38
|
}
|
|
36
|
-
exports.
|
|
39
|
+
exports.consultEye = consultEye;
|
|
37
40
|
/**
|
|
38
41
|
* A SWIPL transformer that loads and consults eye.pl in the
|
|
39
42
|
* given SWIPL module
|
|
@@ -41,9 +44,7 @@ exports.queryOnce = queryOnce;
|
|
|
41
44
|
* @returns The same SWIPL module with EYE loaded and consulted
|
|
42
45
|
*/
|
|
43
46
|
function loadEye(Module) {
|
|
44
|
-
Module
|
|
45
|
-
queryOnce(Module, 'consult', 'eye.pl');
|
|
46
|
-
return Module;
|
|
47
|
+
return consultEye(writeEye(Module));
|
|
47
48
|
}
|
|
48
49
|
exports.loadEye = loadEye;
|
|
49
50
|
/**
|
|
@@ -56,7 +57,7 @@ exports.loadEye = loadEye;
|
|
|
56
57
|
function runQuery(Module, data, queryString) {
|
|
57
58
|
Module.FS.writeFile('data.nq', data);
|
|
58
59
|
Module.FS.writeFile('query.nq', queryString);
|
|
59
|
-
queryOnce(Module, 'main', ['--quiet', './data.nq', '--query', './query.nq']);
|
|
60
|
+
(0, query_1.queryOnce)(Module, 'main', ['--quiet', './data.nq', '--query', './query.nq']);
|
|
60
61
|
return Module;
|
|
61
62
|
}
|
|
62
63
|
exports.runQuery = runQuery;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyereasoner",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Distributing the [EYE](https://github.com/josd/eye) reasoner for browser and node using WebAssembly.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"eye:fetch": "ts-node scripts/fetch-eye",
|
|
23
23
|
"eye:build": "rollup --config rollup.config.mjs",
|
|
24
24
|
"eye:prepare": "npm run eye:fetch && npm run eye:build",
|
|
25
|
-
"eye:update": "ts-node scripts/update"
|
|
25
|
+
"eye:update": "ts-node scripts/update",
|
|
26
|
+
"perf": "ts-node perf/socrates"
|
|
26
27
|
},
|
|
27
28
|
"repository": {
|
|
28
29
|
"type": "git",
|