From 0a739a4917ab7e43c095ad9f4433547b34d0f137 Mon Sep 17 00:00:00 2001 From: Patrick Hochstenbach Date: Wed, 26 Jun 2024 10:34:31 +0200 Subject: [PATCH] Fixing examples --- config.json-example | 6 +++--- lib/eye.js | 5 +++-- lib/latar.js | 4 ++-- lib/tension.js | 7 +++++-- test/pure/disjunction.n3s | 5 ++++- test/pure/disjunction2.n3s | 5 ++++- test/pure/rdfs.n3s | 5 ++++- test/pure/socrates.n3s | 5 ++++- 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/config.json-example b/config.json-example index 225fcf0..8a763fd 100644 --- a/config.json-example +++ b/config.json-example @@ -2,16 +2,16 @@ "eye": { "path": "/usr/local/bin/eye", "args": "--nope --no-bnode-relabeling --quiet", - "timeout": "10s" + "timeout": "10" }, "tension": { "path": "/Users/hochsten/github.com/joachimvh/tension.js/bin/tension.js", "args": "-f", - "timeout": "10s" + "timeout": "10" }, "latar": { "path": "/Users/hochsten/github.com/KNowledgeOnWebScale/Latar/latar", "args": "", - "timeout": "10s" + "timeout": "10" } } \ No newline at end of file diff --git a/lib/eye.js b/lib/eye.js index 7685bc1..dee0284 100644 --- a/lib/eye.js +++ b/lib/eye.js @@ -8,8 +8,8 @@ async function reason(filePath, config) { } try { - const command = `timeout ${config.eye.timeout} ${config.eye.path} ${config.eye.args} ${filePath} > ${filePath}.out 2>&1`; - exec(command, () => { + const command = `${config.eye.path} ${config.eye.args} ${filePath} > ${filePath}.out 2>&1`; + exec(command, { timeout: config.eye.timeout * 1000 } , () => { const output = fs.readFileSync(`${filePath}.out`, { encoding: 'utf-8'}); if (config.type == 'normal' && output.match(/.*:test.*is.*true/g)) { @@ -24,6 +24,7 @@ async function reason(filePath, config) { }); } catch (e) { + console.error(e); resolve(false); } }); diff --git a/lib/latar.js b/lib/latar.js index 1c59103..4813031 100644 --- a/lib/latar.js +++ b/lib/latar.js @@ -8,8 +8,8 @@ async function reason(filePath, config) { } try { - const command = `timeout ${config.latar.timeout} ${config.latar.path} ${config.latar.args} ${filePath} > ${filePath}.out 2>&1`; - exec(command, () => { + const command = `${config.latar.path} ${config.latar.args} ${filePath} > ${filePath}.out 2>&1`; + exec(command, {timeout: config.latar.timeout * 1000 }, () => { const output = fs.readFileSync(`${filePath}.out`, { encoding: 'utf-8'}); if (config.type == 'normal' && output.match(/.*:test.*is.*true/g)) { diff --git a/lib/tension.js b/lib/tension.js index 3f492f6..eb0f39c 100644 --- a/lib/tension.js +++ b/lib/tension.js @@ -8,8 +8,8 @@ async function reason(filePath, config) { } try { - const command = `timeout ${config.tension.timeout} ${config.tension.path} ${config.tension.args} ${filePath} > ${filePath}.out 2>&1`; - exec(command, () => { + const command = `${config.tension.path} ${config.tension.args} ${filePath} > ${filePath}.out 2>&1`; + exec(command, { timeout: config.tension.timeout * 1000 } , () => { const output = fs.readFileSync(`${filePath}.out`, { encoding: 'utf-8'}); if (config.type == 'normal' && output.match(/.*:test.*is.*true/g)) { @@ -18,6 +18,9 @@ async function reason(filePath, config) { else if (config.type == 'fail' && output.match(/Found a contradiction at root level/g)) { resolve(true); } + else if (output.match(/Please don't put lists in subject for now/g)) { + resolve(null); + } else { resolve(false); } diff --git a/test/pure/disjunction.n3s b/test/pure/disjunction.n3s index 5fad5dc..6c66457 100644 --- a/test/pure/disjunction.n3s +++ b/test/pure/disjunction.n3s @@ -43,8 +43,11 @@ } . } . -(_:S _:O) log:onQuerySurface { +(_:S _:O) log:onNegativeSurface { _:S a _:O . + () log:onNegativeAnswerSurface { + _:S a _:O . + } . } . # Test diff --git a/test/pure/disjunction2.n3s b/test/pure/disjunction2.n3s index 558fb3d..47c6de2 100644 --- a/test/pure/disjunction2.n3s +++ b/test/pure/disjunction2.n3s @@ -58,8 +58,11 @@ } . } . -(_:S _:O) log:onQuerySurface { +(_:S _:O) log:onNegativeSurface { _:S a _:O . + () log:onNegativeAnswerSurface { + _:S a _:O . + } . } . # Test diff --git a/test/pure/rdfs.n3s b/test/pure/rdfs.n3s index 2cd8eef..1bc0317 100644 --- a/test/pure/rdfs.n3s +++ b/test/pure/rdfs.n3s @@ -64,8 +64,11 @@ } . # Find out what we need to serve Alice -(_:S _:O _:T) log:onQuerySurface { +(_:O) log:onNegativeSurface { :Alice :consumes _:O . + () log:onNegativeAnswerSurface { + :Alice :consumes _:O . + } . } . #################################################################### diff --git a/test/pure/socrates.n3s b/test/pure/socrates.n3s index 745ec76..eea3986 100644 --- a/test/pure/socrates.n3s +++ b/test/pure/socrates.n3s @@ -20,6 +20,9 @@ }. }. -() log:onQuerySurface { +() log:onNegativeSurface { :test :is true. + () log:onNegativeAnswerSurface { + :test :is true. + } }.