Skip to content

Commit

Permalink
Fixing examples
Browse files Browse the repository at this point in the history
  • Loading branch information
phochste committed Jun 26, 2024
1 parent ba56ed0 commit 0a739a4
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
6 changes: 3 additions & 3 deletions config.json-example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
5 changes: 3 additions & 2 deletions lib/eye.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -24,6 +24,7 @@ async function reason(filePath, config) {
});
}
catch (e) {
console.error(e);
resolve(false);
}
});
Expand Down
4 changes: 2 additions & 2 deletions lib/latar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
7 changes: 5 additions & 2 deletions lib/tension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion test/pure/disjunction.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@
} .
} .

(_:S _:O) log:onQuerySurface {
(_:S _:O) log:onNegativeSurface {
_:S a _:O .
() log:onNegativeAnswerSurface {
_:S a _:O .
} .
} .

# Test
Expand Down
5 changes: 4 additions & 1 deletion test/pure/disjunction2.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@
} .
} .

(_:S _:O) log:onQuerySurface {
(_:S _:O) log:onNegativeSurface {
_:S a _:O .
() log:onNegativeAnswerSurface {
_:S a _:O .
} .
} .

# Test
Expand Down
5 changes: 4 additions & 1 deletion test/pure/rdfs.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
} .
} .

####################################################################
Expand Down
5 changes: 4 additions & 1 deletion test/pure/socrates.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
}.
}.

() log:onQuerySurface {
() log:onNegativeSurface {
:test :is true.
() log:onNegativeAnswerSurface {
:test :is true.
}
}.

0 comments on commit 0a739a4

Please sign in to comment.