eyereasoner 1.0.1 → 1.0.3

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
@@ -8,7 +8,7 @@ Distributing the [EYE](https://github.com/josd/eye) reasoner for browser and nod
8
8
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
9
9
 
10
10
  ## Usage
11
-
11
+ <!--
12
12
  The simplest way to use this package is to execute a query over a dataset and get the results
13
13
 
14
14
  ```ts
@@ -21,19 +21,40 @@ async function main() {
21
21
  main();
22
22
  ```
23
23
 
24
+ Here the inputs and outputs are both arrays of RDF/JS Quads
25
+
24
26
  ## Advanced usage
25
27
 
26
- To have more granular control once can also use this module as follows
28
+ To have more granular control one can also use this module as follows
29
+ -->
30
+
31
+ An example usage of the module is as follows
27
32
 
28
33
  ```ts
29
- import { SWIPL, loadEye } from 'eyereasoner';
34
+ import { SWIPL, loadEye, queryOnce } from 'eyereasoner';
35
+
36
+ const query = `
37
+ @prefix : <http://example.org/socrates#>.
38
+
39
+ {:Socrates a ?WHAT} => {:Socrates a ?WHAT}.
40
+ `
41
+
42
+ const data = `
43
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
44
+ @prefix : <http://example.org/socrates#>.
45
+
46
+ :Socrates a :Human.
47
+ :Human rdfs:subClassOf :Mortal.
48
+
49
+ {?A rdfs:subClassOf ?B. ?S a ?A} => {?S a ?B}.
50
+ `
30
51
 
31
52
  async function main() {
32
53
  // Instantiate a new SWIPL module and log any results it produces to the console
33
54
  const Module = await SWIPL({ print: (str: string) => { console.log(str) }, arguments: ['-q'] });
34
55
 
35
56
  // Load EYE into the SWIPL Module and run consule("eye.pl").
36
- loadEye(MODULE)
57
+ loadEye(Module)
37
58
 
38
59
  // Load the the strings data and query as files data.n3 and query.n3 into the module
39
60
  Module.FS.writeFile('data.n3', data);
@@ -42,6 +63,9 @@ async function main() {
42
63
  // Execute main(['--quiet', './data.n3', '--query', './query.n3']).
43
64
  queryOnce(Module, 'main', ['--quiet', './data.n3', '--query', './query.n3']);
44
65
  }
66
+
67
+ main();
68
+
45
69
  ```
46
70
 
47
71
  ## License
@@ -92,8 +92,8 @@ exports.executeBasicEyeQuery = executeBasicEyeQuery;
92
92
  */
93
93
  function executeBasicEyeQueryQuads(swipl, data, queryString) {
94
94
  return __awaiter(this, void 0, void 0, function* () {
95
- const parser = new n3_1.Parser();
96
- const writer = new n3_1.Writer();
95
+ const parser = new n3_1.Parser({ format: 'text/n3' });
96
+ const writer = new n3_1.Writer({ format: 'text/n3' });
97
97
  return parser.parse(yield executeBasicEyeQuery(swipl, writer.quadsToString(data), writer.quadsToString(queryString)));
98
98
  });
99
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyereasoner",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",
@@ -16,20 +16,29 @@
16
16
  "test": "jest",
17
17
  "lint": "eslint lib/**/*.ts __tests__/* scripts/* --ext .ts",
18
18
  "lint:fix": "eslint lib/**/*.ts __tests__/* scripts/* --ext .ts --fix",
19
- "build": "tsc",
20
- "prepare": "npm run eye:prepare && npm run build",
19
+ "build": "npm run eye:prepare && tsc",
20
+ "prepare": "npm run build",
21
21
  "semantic-release": "semantic-release",
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",
26
- "postinstall": "npm run eye:prepare"
25
+ "eye:update": "ts-node scripts/update"
27
26
  },
28
27
  "repository": {
29
28
  "type": "git",
30
29
  "url": "https://github.com/eyereasoner/eye-js.git"
31
30
  },
32
- "keywords": [],
31
+ "keywords": [
32
+ "eye",
33
+ "eye-js",
34
+ "reasoning",
35
+ "reasoner",
36
+ "rdf",
37
+ "owl",
38
+ "semantic",
39
+ "surfaces",
40
+ "solid"
41
+ ],
33
42
  "author": "Jesse Wright <https://github.com/jeswr/>",
34
43
  "contributors": [
35
44
  "Jesse Wright <https://github.com/jeswr/>",
@@ -51,6 +60,7 @@
51
60
  "eslint-config-airbnb-base": "^15.0.0",
52
61
  "eslint-plugin-import": "^2.26.0",
53
62
  "jest": "^29.3.1",
63
+ "jest-rdf": "^1.7.1",
54
64
  "pre-commit": "^1.2.2",
55
65
  "rollup": "^3.8.1",
56
66
  "rollup-plugin-string": "^3.0.0",