eyeling 1.30.5 → 1.31.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.
Files changed (60) hide show
  1. package/README.md +0 -157
  2. package/dist/browser/eyeling.browser.js +13 -561
  3. package/eyeling.js +13 -561
  4. package/index.d.ts +0 -4
  5. package/index.js +1 -2
  6. package/lib/cli.js +4 -11
  7. package/lib/engine.js +6 -14
  8. package/lib/lexer.js +0 -4
  9. package/lib/multisource.js +3 -5
  10. package/package.json +3 -6
  11. package/test/examples.test.js +5 -37
  12. package/test/playground.test.js +1 -1
  13. package/test/run.js +60 -0
  14. package/examples/input/rdf-surfaces-all-values-from-reverse.ttl +0 -17
  15. package/examples/input/rdf-surfaces-all-values-from.ttl +0 -13
  16. package/examples/input/rdf-surfaces-ancestor.ttl +0 -20
  17. package/examples/input/rdf-surfaces-city.ttl +0 -11
  18. package/examples/input/rdf-surfaces-disjunction-elimination.ttl +0 -16
  19. package/examples/input/rdf-surfaces-disjunction-route-filter.ttl +0 -11
  20. package/examples/input/rdf-surfaces-domain.ttl +0 -11
  21. package/examples/input/rdf-surfaces-explicit-disjunction.ttl +0 -22
  22. package/examples/input/rdf-surfaces-multi-premise.ttl +0 -13
  23. package/examples/input/rdf-surfaces-owl-all-values-from-codex.ttl +0 -35
  24. package/examples/input/rdf-surfaces-property-chain.ttl +0 -13
  25. package/examples/input/rdf-surfaces-range.ttl +0 -11
  26. package/examples/input/rdf-surfaces-rdfs-range-codex.ttl +0 -18
  27. package/examples/input/rdf-surfaces-rdfs-subclass-codex.ttl +0 -18
  28. package/examples/input/rdf-surfaces-strong-negation-access.ttl +0 -14
  29. package/examples/output/rdf-surfaces-all-values-from-reverse.n3 +0 -3
  30. package/examples/output/rdf-surfaces-all-values-from.n3 +0 -3
  31. package/examples/output/rdf-surfaces-ancestor.n3 +0 -5
  32. package/examples/output/rdf-surfaces-city.n3 +0 -3
  33. package/examples/output/rdf-surfaces-disjunction-elimination.n3 +0 -3
  34. package/examples/output/rdf-surfaces-disjunction-route-filter.n3 +0 -3
  35. package/examples/output/rdf-surfaces-domain.n3 +0 -3
  36. package/examples/output/rdf-surfaces-explicit-disjunction.n3 +0 -3
  37. package/examples/output/rdf-surfaces-multi-premise.n3 +0 -3
  38. package/examples/output/rdf-surfaces-owl-all-values-from-codex.n3 +0 -6
  39. package/examples/output/rdf-surfaces-property-chain.n3 +0 -3
  40. package/examples/output/rdf-surfaces-range.n3 +0 -3
  41. package/examples/output/rdf-surfaces-rdfs-range-codex.n3 +0 -3
  42. package/examples/output/rdf-surfaces-rdfs-subclass-codex.n3 +0 -3
  43. package/examples/output/rdf-surfaces-strong-negation-access.n3 +0 -4
  44. package/examples/rdf-surfaces-all-values-from-reverse.n3 +0 -6
  45. package/examples/rdf-surfaces-all-values-from.n3 +0 -6
  46. package/examples/rdf-surfaces-ancestor.n3 +0 -6
  47. package/examples/rdf-surfaces-city.n3 +0 -6
  48. package/examples/rdf-surfaces-disjunction-elimination.n3 +0 -13
  49. package/examples/rdf-surfaces-disjunction-route-filter.n3 +0 -24
  50. package/examples/rdf-surfaces-domain.n3 +0 -6
  51. package/examples/rdf-surfaces-explicit-disjunction.n3 +0 -16
  52. package/examples/rdf-surfaces-multi-premise.n3 +0 -6
  53. package/examples/rdf-surfaces-owl-all-values-from-codex.n3 +0 -10
  54. package/examples/rdf-surfaces-property-chain.n3 +0 -6
  55. package/examples/rdf-surfaces-range.n3 +0 -6
  56. package/examples/rdf-surfaces-rdfs-range-codex.n3 +0 -6
  57. package/examples/rdf-surfaces-rdfs-subclass-codex.n3 +0 -6
  58. package/examples/rdf-surfaces-strong-negation-access.n3 +0 -20
  59. package/lib/rdf_surfaces.js +0 -524
  60. package/test/rdf_surfaces.test.js +0 -214
package/index.d.ts CHANGED
@@ -169,8 +169,6 @@ declare module 'eyeling' {
169
169
  store?: string | StoreOptions;
170
170
  storePath?: string;
171
171
  storeClear?: boolean;
172
- rdf?: boolean;
173
- rdfSurfaces?: boolean;
174
172
  }
175
173
 
176
174
  export interface BuiltinRegistrationContext {
@@ -193,8 +191,6 @@ declare module 'eyeling' {
193
191
  includeInputFactsInClosure?: boolean;
194
192
  enforceHttps?: boolean;
195
193
  rdfjs?: boolean;
196
- rdf?: boolean;
197
- rdfSurfaces?: boolean;
198
194
  dataFactory?: RdfJsDataFactory | null;
199
195
  skipUnsupportedRdfJs?: boolean;
200
196
  builtinModules?: string | string[];
package/index.js CHANGED
@@ -40,8 +40,7 @@ function reason(opt = {}, input = '') {
40
40
  else args.push('--no-proof-comments');
41
41
  }
42
42
 
43
- if (opt.rdf || opt.rdfSurfaces) args.push('--rdf');
44
- if (opt.rdfSurfaces) args.push('--rdf-surfaces');
43
+ if (opt.rdf) args.push('--rdf');
45
44
 
46
45
  if (typeof opt.store === 'string' && opt.store) args.push('--store', opt.store);
47
46
  else if (opt.store && typeof opt.store === 'object') {
package/lib/cli.js CHANGED
@@ -685,7 +685,7 @@ async function ingestLineBasedRdfSourceToStore(sourceLabel, store, { rdfMode = t
685
685
  }
686
686
 
687
687
 
688
- async function runStreamMessagesMode(sourceLabels, { rdfMode, rdfSurfacesMode = false, storeName = null, storePath = null, storeClear = false } = {}) {
688
+ async function runStreamMessagesMode(sourceLabels, { rdfMode, storeName = null, storePath = null, storeClear = false } = {}) {
689
689
  const ordinarySourceLabels = [];
690
690
  const messageSourceLabels = [];
691
691
 
@@ -723,7 +723,6 @@ async function runStreamMessagesMode(sourceLabels, { rdfMode, rdfSurfacesMode =
723
723
  keepSourceArtifacts: false,
724
724
  sourceLocations: false,
725
725
  rdf: rdfMode,
726
- rdfSurfaces: rdfSurfacesMode,
727
726
  }),
728
727
  );
729
728
  } catch (e) {
@@ -757,7 +756,6 @@ async function runStreamMessagesMode(sourceLabels, { rdfMode, rdfSurfacesMode =
757
756
  keepSourceArtifacts: false,
758
757
  sourceLocations: false,
759
758
  rdf: false,
760
- rdfSurfaces: false,
761
759
  });
762
760
  } catch (e) {
763
761
  if (e && e.name === 'N3SyntaxError') {
@@ -812,7 +810,6 @@ async function main() {
812
810
  ` -h, --help Show this help and exit.\n` +
813
811
  ` -p, --proof Enable proof explanations.\n` +
814
812
  ` -r, --rdf Enable RDF/TriG input/output compatibility.\n` +
815
- ` --rdf-surfaces Enable RDF Surfaces %not[...%] syntax (implies --rdf).\n` +
816
813
  ` --stream-messages Process RDF Message Logs one message at a time under -r.\n` +
817
814
  ` --store <name> Use an optional persistent fact store.\n` +
818
815
  ` --store-clear Clear the named store before this run.\n` +
@@ -888,8 +885,7 @@ async function main() {
888
885
  const showAst = argv.includes('--ast') || argv.includes('-a');
889
886
  const streamMode = argv.includes('--stream') || argv.includes('-t');
890
887
  const streamMessagesMode = argv.includes('--stream-messages');
891
- const rdfSurfacesMode = argv.includes('--rdf-surfaces');
892
- const rdfMode = argv.includes('--rdf') || argv.includes('-r') || rdfSurfacesMode;
888
+ const rdfMode = argv.includes('--rdf') || argv.includes('-r');
893
889
  const storeName = argv.__storeName || null;
894
890
  const storePath = argv.__storePath || null;
895
891
  const storeClear = argv.includes('--store-clear');
@@ -958,7 +954,7 @@ async function main() {
958
954
  }
959
955
 
960
956
  if (streamMessagesMode) {
961
- await runStreamMessagesMode(sourceLabels, { rdfMode, rdfSurfacesMode, storeName, storePath, storeClear });
957
+ await runStreamMessagesMode(sourceLabels, { rdfMode, storeName, storePath, storeClear });
962
958
  return;
963
959
  }
964
960
 
@@ -1012,7 +1008,6 @@ async function main() {
1012
1008
  keepSourceArtifacts: false,
1013
1009
  sourceLocations: false,
1014
1010
  rdf: rdfMode,
1015
- rdfSurfaces: rdfSurfacesMode,
1016
1011
  }),
1017
1012
  );
1018
1013
  } catch (e) {
@@ -1025,7 +1020,7 @@ async function main() {
1025
1020
  }
1026
1021
 
1027
1022
  const mergedRuleDocument = mergeParsedDocuments(parsedRuleSources);
1028
- const result = await engine.runStoreBacked(mergedRuleDocument, store, { rdf: rdfMode, rdfSurfaces: rdfSurfacesMode });
1023
+ const result = await engine.runStoreBacked(mergedRuleDocument, store, { rdf: rdfMode });
1029
1024
  const outTriples = result.queryMode ? result.queryTriples || [] : (result.derived || []).map((df) => df.fact);
1030
1025
  if (result.queryMode) {
1031
1026
  const bodyText = engine.prettyPrintQueryTriples(outTriples, result.prefixes);
@@ -1060,7 +1055,6 @@ async function main() {
1060
1055
  keepSourceArtifacts: false,
1061
1056
  sourceLocations: engine.getProofCommentsEnabled(),
1062
1057
  rdf: rdfMode,
1063
- rdfSurfaces: rdfSurfacesMode,
1064
1058
  }),
1065
1059
  );
1066
1060
  } catch (e) {
@@ -1161,7 +1155,6 @@ function factsContainOutputStrings(triplesForOutput) {
1161
1155
  {
1162
1156
  proof: engine.getProofCommentsEnabled(),
1163
1157
  rdf: rdfMode,
1164
- rdfSurfaces: rdfSurfacesMode,
1165
1158
  store: { name: storeName, clear: storeClear, path: storePath || undefined },
1166
1159
  },
1167
1160
  );
package/lib/engine.js CHANGED
@@ -3623,14 +3623,12 @@ function reasonStream(input, opts = {}) {
3623
3623
  skipUnsupportedRdfJs = false,
3624
3624
  builtinModules = null,
3625
3625
  rdf = false,
3626
- rdfSurfaces = false,
3627
3626
  sourceLabel = '<input>',
3628
3627
  } = opts;
3629
3628
 
3630
- const useRdfCompatibility = !!rdf || !!rdfSurfaces;
3631
- const useRdfSurfaces = !!rdfSurfaces;
3629
+ const useRdfCompatibility = !!rdf;
3632
3630
 
3633
- const parsedSourceList = parseN3SourceList(input, { baseIri, rdf: useRdfCompatibility, rdfSurfaces: useRdfSurfaces, sourceLocations: proof });
3631
+ const parsedSourceList = parseN3SourceList(input, { baseIri, rdf: useRdfCompatibility, sourceLocations: proof });
3634
3632
  const parsedTextInput = (!parsedSourceList && proof && typeof input === 'string')
3635
3633
  ? parseN3Text(input, {
3636
3634
  baseIri: baseIri || '',
@@ -3638,7 +3636,6 @@ function reasonStream(input, opts = {}) {
3638
3636
  keepSourceArtifacts: false,
3639
3637
  sourceLocations: true,
3640
3638
  rdf: useRdfCompatibility,
3641
- rdfSurfaces: useRdfSurfaces,
3642
3639
  })
3643
3640
  : null;
3644
3641
  const hasInlineN3 = input && typeof input === 'object' && !Array.isArray(input) && typeof input.n3 === 'string';
@@ -3683,7 +3680,6 @@ function reasonStream(input, opts = {}) {
3683
3680
  keepSourceArtifacts: false,
3684
3681
  sourceLocations: proof,
3685
3682
  rdf: useRdfCompatibility,
3686
- rdfSurfaces: useRdfSurfaces,
3687
3683
  });
3688
3684
  prefixes = directDoc.prefixes;
3689
3685
  triples = directDoc.triples;
@@ -3795,11 +3791,10 @@ async function __parseRunAsyncInput(input, opts) {
3795
3791
  baseIri = null,
3796
3792
  proof = false,
3797
3793
  rdf = false,
3798
- rdfSurfaces = false,
3799
3794
  sourceLabel = '<input>',
3800
3795
  } = opts || {};
3801
3796
 
3802
- const parsedSourceList = parseN3SourceList(input, { baseIri, rdf: !!rdf || !!rdfSurfaces, rdfSurfaces: !!rdfSurfaces, sourceLocations: !!proof });
3797
+ const parsedSourceList = parseN3SourceList(input, { baseIri, rdf: !!rdf, sourceLocations: !!proof });
3803
3798
  if (parsedSourceList) return parsedSourceList;
3804
3799
 
3805
3800
  const parsedObject = await normalizeParsedReasonerInputAsync(input);
@@ -3814,8 +3809,7 @@ async function __parseRunAsyncInput(input, opts) {
3814
3809
  label: sourceLabel || '<input>',
3815
3810
  keepSourceArtifacts: false,
3816
3811
  sourceLocations: !!proof,
3817
- rdf: !!rdf || !!rdfSurfaces,
3818
- rdfSurfaces: !!rdfSurfaces,
3812
+ rdf: !!rdf,
3819
3813
  });
3820
3814
  }
3821
3815
 
@@ -3891,8 +3885,7 @@ async function __proveGoalsAgainstStore(goals, subst, store, backRules, localFac
3891
3885
  async function runStoreBacked(input, store, opts = {}) {
3892
3886
  const parsed = parseN3SourceList(input, {
3893
3887
  baseIri: opts.baseIri || null,
3894
- rdf: !!opts.rdf || !!opts.rdfSurfaces,
3895
- rdfSurfaces: !!opts.rdfSurfaces,
3888
+ rdf: !!opts.rdf,
3896
3889
  sourceLocations: !!opts.proof,
3897
3890
  }) || input;
3898
3891
 
@@ -4009,8 +4002,7 @@ async function runAsync(input, opts = {}) {
4009
4002
  if (!storeConfig) {
4010
4003
  const normalizedInput = parseN3SourceList(input, {
4011
4004
  baseIri: runOpts.baseIri || null,
4012
- rdf: !!runOpts.rdf || !!runOpts.rdfSurfaces,
4013
- rdfSurfaces: !!runOpts.rdfSurfaces,
4005
+ rdf: !!runOpts.rdf,
4014
4006
  sourceLocations: !!runOpts.proof,
4015
4007
  }) || (await normalizeReasonerInputAsync(input));
4016
4008
  return reasonStream(normalizedInput, runOpts);
package/lib/lexer.js CHANGED
@@ -7,8 +7,6 @@
7
7
 
8
8
  'use strict';
9
9
 
10
- const { normalizeRdfSurfaces } = require('./rdf_surfaces');
11
-
12
10
  class Token {
13
11
  constructor(typ, value = null, offset = null) {
14
12
  this.typ = typ;
@@ -1349,9 +1347,7 @@ function isNumericLikeIdentifier(word) {
1349
1347
 
1350
1348
  function lex(inputText, opts = {}) {
1351
1349
  const rdf = !!(opts && opts.rdf);
1352
- const rdfSurfaces = !!(opts && opts.rdfSurfaces);
1353
1350
  if (rdf) inputText = normalizeRdfCompatibility(inputText);
1354
- if (rdfSurfaces) inputText = normalizeRdfSurfaces(inputText);
1355
1351
  // Avoid copying large ASCII/BMP inputs into an Array. Array.from() is
1356
1352
  // only needed when the text contains surrogate pairs and we want the old
1357
1353
  // code-point iteration behavior for non-BMP characters.
@@ -172,10 +172,9 @@ function parseN3Text(text, opts = {}) {
172
172
  collectUsedPrefixes = false,
173
173
  sourceLocations = false,
174
174
  rdf = false,
175
- rdfSurfaces = false,
176
175
  } = opts || {};
177
176
 
178
- if (rdf && !rdfSurfaces) {
177
+ if (rdf) {
179
178
  const fastDoc = tryParseFastRdfText(text, { baseIri, label });
180
179
  if (fastDoc) {
181
180
  if (sourceLocations) annotateParsedSourceLocations(fastDoc, text, label);
@@ -184,7 +183,7 @@ function parseN3Text(text, opts = {}) {
184
183
  }
185
184
  }
186
185
 
187
- const tokens = lex(text, { rdf, rdfSurfaces });
186
+ const tokens = lex(text, { rdf });
188
187
  const parser = new Parser(tokens);
189
188
  if (baseIri) parser.prefixes.setBase(baseIri);
190
189
  const [prefixes, triples, frules, brules, logQueryRules] = parser.parseDocument();
@@ -383,8 +382,7 @@ function parseN3SourceList(input, opts = {}) {
383
382
  collectUsedPrefixes: true,
384
383
  keepSourceArtifacts: !!opts.keepSourceArtifacts,
385
384
  sourceLocations: !!opts.sourceLocations,
386
- rdf: !!opts.rdf || !!opts.rdfSurfaces,
387
- rdfSurfaces: !!opts.rdfSurfaces,
385
+ rdf: !!opts.rdf,
388
386
  }),
389
387
  );
390
388
  return mergeParsedDocuments(parsed, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.30.5",
3
+ "version": "1.31.0",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
@@ -42,8 +42,7 @@
42
42
  "lint:fix": "eslint . --fix",
43
43
  "build": "node tools/bundle.js",
44
44
  "test:packlist": "node test/packlist.test.js",
45
- "test:api": "node test/api.test.js && node test/stream_messages.test.js && node test/rdf_surfaces.test.js",
46
- "test:rdf-surfaces": "node test/rdf_surfaces.test.js",
45
+ "test:api": "node test/api.test.js",
47
46
  "test:builtins": "node test/builtins.test.js",
48
47
  "test:store": "node test/store.test.js",
49
48
  "test:examples": "node test/examples.test.js",
@@ -57,9 +56,7 @@
57
56
  "test:rdf12:trig": "node test/rdf12.test.js trig",
58
57
  "test:playground": "node test/playground.test.js",
59
58
  "test:package": "node test/package.test.js",
60
- "pretest": "npm run build && npm run test:packlist",
61
- "test": "npm run test:api && npm run test:builtins && npm run test:store && npm run test:examples && npm run test:examples:proof && npm run test:manifest && npm run test:rdf12 && npm run test:playground",
62
- "posttest": "npm run test:package",
59
+ "test": "node test/run.js",
63
60
  "preversion": "npm test",
64
61
  "postversion": "git push origin HEAD --follow-tags"
65
62
  },
@@ -152,27 +152,6 @@ function resolveExampleTrigInput(root, inputFile) {
152
152
  return { abs, rel };
153
153
  }
154
154
 
155
- function resolveExampleRdfSurfaceInput(root, inputFile) {
156
- const stem = path.basename(inputFile, path.extname(inputFile));
157
- const rel = path.join('input', `${stem}.ttl`);
158
- const abs = path.join(root, 'examples', rel);
159
- if (!fs.existsSync(abs)) return null;
160
- const text = fs.readFileSync(abs, 'utf8');
161
- if (!text.includes('%not[')) return null;
162
- return { abs, rel };
163
- }
164
-
165
-
166
- function exampleOptionFlags(sourceText) {
167
- const m = String(sourceText || '').match(/^[ \t]*#\s*eyeling-options:\s*(.*?)\s*$/m);
168
- if (!m) return [];
169
- return m[1].trim().split(/\s+/).filter(Boolean);
170
- }
171
-
172
- function addUniqueFlag(args, flag) {
173
- if (!args.includes(flag)) args.push(flag);
174
- }
175
-
176
155
  function resolveExampleBuiltinPath(root, inputFile) {
177
156
  const stem = path.basename(inputFile, path.extname(inputFile));
178
157
  const rel = path.join('examples', 'builtin', `${stem}.js`);
@@ -181,13 +160,10 @@ function resolveExampleBuiltinPath(root, inputFile) {
181
160
  return { abs, rel };
182
161
  }
183
162
 
184
- function runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath, proof = false, sourceText = '' }) {
163
+ function runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath, proof = false }) {
185
164
  const builtin = resolveExampleBuiltinPath(root, file);
186
165
  const trigInput = resolveExampleTrigInput(root, file);
187
- const rdfSurfaceInput = resolveExampleRdfSurfaceInput(root, file);
188
- const optionFlags = exampleOptionFlags(sourceText);
189
- const rdfSurfacesMode = !!rdfSurfaceInput || optionFlags.includes('--rdf-surfaces');
190
- const rdfMode = !!trigInput || rdfSurfacesMode || optionFlags.includes('--rdf') || optionFlags.includes('-r');
166
+ const rdfMode = !!trigInput;
191
167
  const modeFlag = proof ? '-p' : '-d';
192
168
  const outFd = fs.openSync(generatedPath, 'w');
193
169
 
@@ -195,12 +171,7 @@ function runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, ge
195
171
  if (builtin) {
196
172
  const args = [eyelingJsPath, modeFlag];
197
173
  if (rdfMode) args.push('-r');
198
- for (const flag of optionFlags) addUniqueFlag(args, flag);
199
- if (rdfSurfacesMode) addUniqueFlag(args, '--rdf-surfaces');
200
- args.push('--builtin');
201
- args.push(builtin.rel);
202
- if (rdfSurfaceInput) args.push(path.join('examples', rdfSurfaceInput.rel));
203
- args.push(path.join('examples', file));
174
+ args.push('--builtin', builtin.rel, path.join('examples', file));
204
175
  if (trigInput) args.push(path.join('examples', trigInput.rel));
205
176
  return cp.spawnSync(nodePath, args, {
206
177
  cwd: root,
@@ -212,9 +183,6 @@ function runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, ge
212
183
 
213
184
  const args = [eyelingJsPath, modeFlag];
214
185
  if (rdfMode) args.push('-r');
215
- for (const flag of optionFlags) addUniqueFlag(args, flag);
216
- if (rdfSurfacesMode) addUniqueFlag(args, '--rdf-surfaces');
217
- if (rdfSurfaceInput) args.push(rdfSurfaceInput.rel);
218
186
  args.push(file);
219
187
  if (trigInput) args.push(trigInput.rel);
220
188
  return cp.spawnSync(nodePath, args, {
@@ -322,7 +290,7 @@ function main() {
322
290
  // node eyeling.js --builtin examples/builtin/foo.js examples/foo.n3
323
291
  // A matching examples/input/<stem>.trig sidecar is external RDF/TriG
324
292
  // evidence for this example, so include it and run in -r mode automatically.
325
- const r = runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath, sourceText: n3Text });
293
+ const r = runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath });
326
294
 
327
295
  const rc = r.status == null ? 1 : r.status;
328
296
 
@@ -390,7 +358,7 @@ function main() {
390
358
  const expectedRc = expectedExitCode(n3Text);
391
359
  const tmpDir = mkTmpDir();
392
360
  const generatedPath = path.join(tmpDir, 'generated.n3');
393
- const r = runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath, proof: true, sourceText: n3Text });
361
+ const r = runExampleToFile({ root, examplesDir, eyelingJsPath, nodePath, file, generatedPath, proof: true });
394
362
  const rc = r.status == null ? 1 : r.status;
395
363
  const ms = Date.now() - start;
396
364
 
@@ -62,7 +62,7 @@ function guessContentType(p) {
62
62
  if (ext === '.js') return 'application/javascript; charset=utf-8';
63
63
  if (ext === '.css') return 'text/css; charset=utf-8';
64
64
  if (ext === '.json') return 'application/json; charset=utf-8';
65
- if (ext === '.ttl' || ext === '.n3') return 'text/plain; charset=utf-8';
65
+ if (ext === '.ttl' || ext === '.trig' || ext === '.n3') return 'text/plain; charset=utf-8';
66
66
  if (ext === '.txt' || ext === '.md') return 'text/plain; charset=utf-8';
67
67
  return 'application/octet-stream';
68
68
  }
package/test/run.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const cp = require('node:child_process');
5
+
6
+ const { C, formatDuration } = require('./report');
7
+
8
+ const sections = [
9
+ ['Build bundle', 'npm', ['run', 'build']],
10
+ ['Packlist checks', 'npm', ['run', 'test:packlist']],
11
+ ['API tests', 'npm', ['run', 'test:api']],
12
+ ['Streaming RDF Messages tests', 'npm', ['run', 'test:stream-messages']],
13
+ ['Builtin contract tests', 'npm', ['run', 'test:builtins']],
14
+ ['Store tests', 'npm', ['run', 'test:store']],
15
+ ['Examples tests', 'npm', ['run', 'test:examples']],
16
+ ['Proof examples tests', 'npm', ['run', 'test:examples:proof']],
17
+ ['Manifest tests', 'npm', ['run', 'test:manifest']],
18
+ ['RDF 1.2 syntax tests', 'npm', ['run', 'test:rdf12']],
19
+ ['Playground tests', 'npm', ['run', 'test:playground']],
20
+ ['Package tests', 'npm', ['run', 'test:package']],
21
+ ];
22
+
23
+ function sectionLine(kind, label, ms) {
24
+ const suffix = typeof ms === 'number' ? ` (${formatDuration(ms)})` : '';
25
+ console.log(`${C.y}==${C.n} ${kind} ${label}${suffix}`);
26
+ }
27
+
28
+ function runSection(label, cmd, args) {
29
+ console.log('');
30
+ sectionLine('Start', label);
31
+ const startedAt = Date.now();
32
+ const r = cp.spawnSync(cmd, args, {
33
+ cwd: process.cwd(),
34
+ env: process.env,
35
+ shell: process.platform === 'win32',
36
+ stdio: 'inherit',
37
+ });
38
+ const elapsed = Date.now() - startedAt;
39
+ if (r.error) {
40
+ console.error(`${C.r}FAIL${C.n} ${label}: ${r.error.message || String(r.error)}`);
41
+ sectionLine('End', `${label} failed`, elapsed);
42
+ console.log('');
43
+ return 1;
44
+ }
45
+ const status = typeof r.status === 'number' ? r.status : 1;
46
+ sectionLine('End', status === 0 ? `${label} passed` : `${label} failed`, elapsed);
47
+ console.log('');
48
+ return status;
49
+ }
50
+
51
+ let status = 0;
52
+ for (const [label, cmd, args] of sections) {
53
+ const sectionStatus = runSection(label, cmd, args);
54
+ if (sectionStatus !== 0) {
55
+ status = sectionStatus;
56
+ break;
57
+ }
58
+ }
59
+
60
+ process.exit(status);
@@ -1,17 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:box ex:contains ex:item42 .
5
- ex:item42 a ex:AllowedItem .
6
-
7
- %not[ _:x
8
- %not[ _:y
9
- _:x ex:contains _:y .
10
- %not[
11
- _:y a ex:AllowedItem .
12
- %]
13
- %]
14
- %not[
15
- _:x a ex:AllowedContainer .
16
- %]
17
- %]
@@ -1,13 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:box a ex:AllowedContainer .
5
- ex:box ex:contains ex:item42 .
6
-
7
- %not[ _:x _:y
8
- _:x a ex:AllowedContainer .
9
- _:x ex:contains _:y .
10
- %not[
11
- _:y a ex:AllowedItem .
12
- %]
13
- %]
@@ -1,20 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:ann ex:parent ex:bob .
5
- ex:bob ex:parent ex:cat .
6
-
7
- %not[ _:x _:y
8
- _:x ex:parent _:y .
9
- %not[
10
- _:x ex:ancestor _:y .
11
- %]
12
- %]
13
-
14
- %not[ _:x _:y _:z
15
- _:x ex:parent _:y .
16
- _:y ex:ancestor _:z .
17
- %not[
18
- _:x ex:ancestor _:z .
19
- %]
20
- %]
@@ -1,11 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:Brussels a ex:City .
5
-
6
- %not[ _:x
7
- _:x a ex:City .
8
- %not[
9
- _:x a ex:HumanCommunity .
10
- %]
11
- %]
@@ -1,16 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:caseSplit ex:option ex:ManualReview .
5
- ex:caseSplit ex:option ex:AutomaticHold .
6
- ex:caseSplit ex:candidateConclusion ex:NeedsHumanAttention .
7
- ex:caseSplit ex:candidateConclusion ex:NoAction .
8
-
9
- ex:ManualReview ex:implies ex:NeedsHumanAttention .
10
- ex:AutomaticHold ex:implies ex:NeedsHumanAttention .
11
- ex:ManualReview ex:implies ex:HasTicket .
12
-
13
- # Strong negation: this case split must not collapse to "no action".
14
- %not[
15
- ex:caseSplit ex:disjunctionEntails ex:NoAction .
16
- %]
@@ -1,11 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:shipment17 a ex:ExpressShipment .
5
- ex:shipment17 ex:destination ex:CityCenter .
6
-
7
- # Strong negation: a drone route to the city center is explicitly denied.
8
- %not[ _:shipment
9
- _:shipment ex:route ex:Drone .
10
- _:shipment ex:destination ex:CityCenter .
11
- %]
@@ -1,11 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:alice ex:memberOf ex:club .
5
-
6
- %not[ _:x _:y
7
- _:x ex:memberOf _:y .
8
- %not[
9
- _:x a ex:Member .
10
- %]
11
- %]
@@ -1,22 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:shipment23 a ex:ExpressShipment .
5
- ex:shipment23 ex:destination ex:CityCenter .
6
-
7
- # Explicit RDF Surfaces disjunction: an express shipment can go by rail or by drone.
8
- %not[ _:shipment
9
- _:shipment a ex:ExpressShipment .
10
- %not[
11
- _:shipment ex:possibleRoute ex:Rail .
12
- %]
13
- %not[
14
- _:shipment ex:possibleRoute ex:Drone .
15
- %]
16
- %]
17
-
18
- # Strong negation: drone delivery to the city center is ruled out.
19
- %not[ _:shipment
20
- _:shipment ex:destination ex:CityCenter .
21
- _:shipment ex:selectedRoute ex:Drone .
22
- %]
@@ -1,13 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:case123 ex:hasSymptom ex:Fever .
5
- ex:case123 ex:hasExposure ex:Travel .
6
-
7
- %not[ _:x
8
- _:x ex:hasSymptom ex:Fever .
9
- _:x ex:hasExposure ex:Travel .
10
- %not[
11
- _:x a ex:PriorityCase .
12
- %]
13
- %]
@@ -1,35 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
- @prefix owl: <http://www.w3.org/2002/07/owl#> .
4
-
5
- ex:AllowedContainer owl:onProperty ex:contains .
6
- ex:AllowedContainer owl:allValuesFrom ex:AllowedItem .
7
- ex:box a ex:AllowedContainer .
8
- ex:box ex:contains ex:item42 .
9
- ex:crate ex:contains ex:item43 .
10
- ex:item43 a ex:AllowedItem .
11
-
12
- %not[ _:a _:b _:c
13
- _:a owl:onProperty _:b .
14
- _:a owl:allValuesFrom _:c .
15
- %not[
16
- %not[ _:x _:y
17
- _:x a _:a .
18
- _:x _:b _:y .
19
- %not[
20
- _:y a _:c .
21
- %]
22
- %]
23
- %not[ _:x
24
- %not[ _:y
25
- _:x _:b _:y .
26
- %not[
27
- _:y a _:c .
28
- %]
29
- %]
30
- %not[
31
- _:x a _:a .
32
- %]
33
- %]
34
- %]
35
- %]
@@ -1,13 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:alice ex:parent ex:bob .
5
- ex:bob ex:parent ex:carol .
6
-
7
- %not[ _:x _:y _:z
8
- _:x ex:parent _:y .
9
- _:y ex:parent _:z .
10
- %not[
11
- _:x ex:grandparent _:z .
12
- %]
13
- %]
@@ -1,11 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
-
4
- ex:alice ex:parent ex:bob .
5
-
6
- %not[ _:x _:y
7
- _:x ex:parent _:y .
8
- %not[
9
- _:y a ex:Person .
10
- %]
11
- %]
@@ -1,18 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
4
-
5
- ex:parent rdfs:range ex:Person .
6
- ex:alice ex:parent ex:bob .
7
-
8
- %not[ _:p _:c
9
- _:p rdfs:range _:c .
10
- %not[
11
- %not[ _:s _:o
12
- _:s _:p _:o .
13
- %not[
14
- _:o a _:c .
15
- %]
16
- %]
17
- %]
18
- %]
@@ -1,18 +0,0 @@
1
- # eyeling-options: --rdf-surfaces
2
- @prefix ex: <http://example.org/> .
3
- @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
4
-
5
- ex:City rdfs:subClassOf ex:HumanCommunity .
6
- ex:Brussels a ex:City .
7
-
8
- %not[ _:c _:d
9
- _:c rdfs:subClassOf _:d .
10
- %not[
11
- %not[ _:x
12
- _:x a _:c .
13
- %not[
14
- _:x a _:d .
15
- %]
16
- %]
17
- %]
18
- %]