-
Notifications
You must be signed in to change notification settings - Fork 7
/
sprog-client.js
executable file
·32 lines (29 loc) · 913 Bytes
/
sprog-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pengines = require('pengines');
peng = pengines({
server: "http://127.0.0.1:9083/pengine",
//ask: "member(X,[a,b,c,d,7])",
ask: "t(X)",
//ask: "between(1,1000,N)",
chunk: 10,
//sourceText: "t(X):- (go ?? rdf(X,rdf:type,owl:'ObjectProperty')).",
//sourceText: "t(X):- (go ?? rdf(X,rdf:type,owl:'ObjectProperty')).\n",
sourceText: "t(X):- (wd ?? continent(X)).\n",
}
).on('success', handleSuccess).on('error', handleError);
function handleSuccess(result) {
console.log('# Results: '+ result.data.length);
for (var i = 0; i < result.data.length; i++) {
console.log(result.data[i])
}
if (result.data.length == 0) {
console.log("No results!")
}
console.log('# More? '+ result.more);
if (result.more) {
n = peng.next();
console.log('# Next = '+ n);
}
}
function handleError(result) {
console.error(result)
}