Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 4 #11

Open
wants to merge 133 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
ad4acf5
heroku config
Dec 11, 2022
6f07e07
use mysql db
Dec 11, 2022
ca342e0
added aptfile
Dec 11, 2022
441aa2a
updated config
Dec 11, 2022
22523c1
added procfile
Dec 11, 2022
0204952
fixing port
Dec 11, 2022
2f678e8
fixing port
Dec 11, 2022
957a7c6
fixing port
Dec 11, 2022
cea097c
fixing port
Dec 11, 2022
c7d8127
fixing port
Dec 11, 2022
075c17e
fixing port
Dec 11, 2022
629bebe
fixing port
Dec 11, 2022
3776136
fixing port
Dec 11, 2022
1bbb154
fixing eye location
Dec 11, 2022
ebb3bad
newer jdk version
Dec 11, 2022
e013479
newer jdk version
Dec 11, 2022
0056328
deal with stderr in java
Dec 11, 2022
8bc87ce
deal with stderr in java
Dec 11, 2022
8a57bcf
removing some logs
Dec 11, 2022
681d5c2
remove static example
Dec 11, 2022
8ffdb2f
fix gen_link
Dec 11, 2022
a9629aa
fix gen_link
Dec 11, 2022
c4ffe9e
fix gen_link
Dec 11, 2022
1bc3ff3
fix gen_link
Dec 11, 2022
e5ddf18
fix gen_link
Dec 11, 2022
811476e
fix gen_link
Dec 11, 2022
3252449
update gen_link
Dec 11, 2022
bfd7ee2
update gen_link
Dec 11, 2022
217c214
update gen_link
Dec 11, 2022
b420c98
update gen_link
Dec 11, 2022
ade5c67
update gen_link
Dec 11, 2022
3cfd760
updated jen3.jar
Dec 11, 2022
8f54e74
'fixing' jen3..
Dec 11, 2022
558b2de
'fixing' jen3..
Dec 11, 2022
f53cf39
adding new codegen.jar
Dec 11, 2022
d5062e2
add crawler
Jan 8, 2023
a1e7e4c
add crawler
Jan 8, 2023
044bdab
add crawler
Jan 8, 2023
1976fbc
update crawler
Jan 8, 2023
bcdf50d
iriPropertyList
Jan 10, 2023
8e5a7e9
minimize dist
Jan 10, 2023
ca3098e
minify parsers & lexers
Jan 10, 2023
b0f248f
update index
Jan 10, 2023
25b84bc
minify parsers & lexers
Jan 10, 2023
5b539cf
update codegen
Jan 16, 2023
fd9512b
update codegen
Jan 16, 2023
34d62c9
update codegen
Jan 16, 2023
32acadb
updated eye
Jan 18, 2023
73049ab
updating work.sh
Jan 21, 2023
fa9fcd0
only feb
Jan 21, 2023
76b1f7e
update eye
Jan 25, 2023
a9428a3
update eye
Jan 25, 2023
f05acdf
update work.sh
Jan 26, 2023
857dfd5
improve n3-mode
Jan 28, 2023
9ce4089
remove eyebrow
Jan 28, 2023
b478834
..
Jan 28, 2023
eb66aea
..
Jan 28, 2023
cf86e1f
..
Jan 28, 2023
80e7cb6
disable imperate for now
Jan 28, 2023
7a03bc3
disable imperate for now
Jan 28, 2023
f774f09
initial commit
Feb 5, 2023
1d77068
initial commit
Feb 5, 2023
ebc1c8f
initial commit
Feb 5, 2023
5a3a231
fix redirect for links
Feb 5, 2023
675bfcf
fix loading icon
Feb 5, 2023
0fa4bdf
fix loading icon
Feb 5, 2023
c3893a1
fix loading icon
Feb 5, 2023
8a2f01c
fix loading icon
Feb 5, 2023
2abe8e3
fix loading icon
Feb 5, 2023
7f3ed7b
fix redirect
Feb 5, 2023
3d48988
update title
Feb 6, 2023
9aa8832
quantify flag
Feb 7, 2023
2114fe0
switch config
Feb 7, 2023
2bbff44
change base for turls
Feb 9, 2023
768391a
change base for turls
Feb 9, 2023
9b99e7c
change base for turls
Feb 9, 2023
4f37bc4
bump eye version
Feb 9, 2023
5e69adc
change base for turls
Feb 9, 2023
e4a7b41
change base for turls
Feb 9, 2023
f610f39
trying to update eye
Feb 9, 2023
514072b
trying to update eye
Feb 9, 2023
388a3a8
support for eye-js
Feb 12, 2023
9c23dd7
support for eye-js
Feb 12, 2023
db789eb
support for eye-js
Feb 12, 2023
3cdd98a
set path for eye
Feb 14, 2023
ae52fbc
set path for eye
Feb 14, 2023
cfdc126
show error when code missing during link gen
Feb 17, 2023
b130442
show error when code missing during link gen
Feb 17, 2023
8746fc7
update to eye v3
Feb 17, 2023
c039fb1
update to eye v3
Feb 17, 2023
d62f83e
update eye version
Feb 17, 2023
fc088ff
added sparql.html
Mar 1, 2023
b92128f
latest eye version
Mar 1, 2023
510ebf9
latest eye version
Mar 1, 2023
2929669
data box a bit bigger
Mar 1, 2023
4add81b
using latest eye-js version (not just v3)
Mar 16, 2023
8f76ebe
format support
Mar 18, 2023
ac4847f
incl comments
Mar 18, 2023
12708be
send comments to hidden channel
Mar 18, 2023
ffe2a13
send comments to hidden channel
Mar 18, 2023
fc8d2a2
keep comments in hidden channel
Mar 19, 2023
829b667
comments with newlines
Mar 20, 2023
1bc024e
comments with newlines
Mar 20, 2023
d54dbf6
format ns | keep ws with comments
Mar 25, 2023
423a45d
keep nl before base
Mar 25, 2023
d48d360
fix endless-nl issue
Mar 25, 2023
f65e0a7
update eye
Apr 1, 2023
8d27b62
update sparql2spin, eye
Apr 9, 2023
2a4db80
update sparql2spin
Apr 9, 2023
debace4
update sparql2spin
Apr 10, 2023
8de09cf
updated eye
Apr 27, 2023
6f390d0
cope w/ updated eye output
Apr 27, 2023
85fa006
add imperate fn
Jul 3, 2023
e1482b1
..
Jul 3, 2023
94e73ad
..
Jul 3, 2023
ab25ef0
..
Jul 3, 2023
283fed2
add spin3 | refactor to use async
Jul 15, 2023
980de45
draft spin3 editor
Jul 15, 2023
f10ac2b
..
Jul 15, 2023
34aebbd
..
Jul 15, 2023
5158d5b
..
Jul 15, 2023
3074897
..
Jul 15, 2023
1cdfe58
..
Jul 15, 2023
d695b2c
..
Jul 15, 2023
78b00c2
..
Jul 15, 2023
70e0544
..
Jul 15, 2023
b2f07c9
..
Jul 15, 2023
5bb17c0
..
Jul 16, 2023
c5b0681
..
Jul 16, 2023
b3e0c8f
updating query splitting
Jul 16, 2023
9930af4
add hint
Jul 16, 2023
2593b76
update css
Jul 16, 2023
e889af3
small fixes
domel Jul 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Aptfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
swi-prolog
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node app.js
211 changes: 160 additions & 51 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ const path = require('path')
const { config } = require('./config.js')
const tmp = require('./lib/tmp.js')
const eye = require('./lib/eye/eye.js')
const cwm = require('./lib/cwm/cwm.js')
// const cwm = require('./lib/cwm/cwm.js')
const jen3 = require('./lib/jen3/jen3.js')
const jena = require('./lib/jena/jena.js')
const triplify = require('./lib/triplify/triplify.js')
const spin3 = require('./lib/spin3/spin3.js')
const { generateLink, resolveLink } = require('./lib/gen_link.js')
const { checkBuiltinInput } = require('./lib/check_builtin_input.js')

Expand All @@ -17,7 +20,15 @@ app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))

app.use('/n3/editor/s/*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/index.html"));
res.sendFile(path.join(__dirname, "editor/index.html"));
});
app.use('/n3/out', express.static("out"));
app.use('/n3/editor/out', express.static("out"));
app.use('/n3/spin3*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/spin3.html"));
});
app.use('/n3/sparql*', (req, res) => {
res.sendFile(path.join(__dirname, "editor/sparql.html"));
});
app.use('/n3/editor', express.static(path.join(__dirname, "editor")));
app.use('/n3/lib/eyebrow', express.static(path.join(__dirname, "lib/eyebrow")));
Expand Down Expand Up @@ -46,8 +57,9 @@ app.post('/n3', (request, response) => {
const data = request.body
// console.log("data:", data);
console.log(
"task:", data.task,
(data.system? ", system: " + data.system : "")
"task:", data.task,
(data.subTask ? ", subTask: " + data.subTask : ""),
(data.system ? ", system: " + data.system : "")
);

function ctu(ret) {
Expand All @@ -73,18 +85,30 @@ app.post('/n3', (request, response) => {
doImperating(data, ctu)
break

case 'generate_link':
doGenerateLink(data, ctu)
case 'triplify':
doTriplify(data, ctu)
break

case 'resolve_link':
doResolveLink(data, ctu)
case 'query':
doQuery(data, ctu)
break

case 'spin3':
doSpin3(data, ctu);
break

case 'check_builtin_input':
doCheckBuiltinInput(data, ctu)
break

case 'generate_link':
doGenerateLink(data, ctu)
break

case 'resolve_link':
doResolveLink(data, ctu)
break

default:
ctu({ error: 'unknown task: ' + data.task })
}
Expand All @@ -93,15 +117,12 @@ app.post('/n3', (request, response) => {
app.listen(config.http.port)
console.log(`Listening at ${config.http.hostname}:${config.http.port}`)

function doReasoning(options, ctu) {
tmp.save(options.formula, (file) => {
async function doReasoning(options, ctu) {
let file;
try {
file = await tmp.save(options.formula)

function end(ret) {
tmp.del(file)
ctu(ret)
}

var reasoner = null;
let reasoner = null;
switch (options.system) {
case "eye":
reasoner = eye
Expand All @@ -116,46 +137,130 @@ function doReasoning(options, ctu) {
break

default:
end({ error: `unsupported system: "${options.system}"` })
break
throw `unsupported system: "${options.system}"`
}
if (reasoner)
reasoner.exec(options, file, end)
})

const output = await reasoner.exec(options, file)
ctu({ success: output })

} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(file)
}
}

function doExplaining(options, ctu) {
tmp.save(options.formula, (file) => {
async function doExplaining(options, ctu) {
let file
try {
file = await tmp.save(options.formula)

var reasoner = null;
let reasoner = null;
switch (options.system) {
case "eye":
reasoner = eye
break

default:
end({ error: `unsupported system: "${options.system}"` })
break
throw `unsupported system: "${options.system}"`
}

reasoner.exec(options, file, (explanation) => {
tmp.del(file)
const explanation = await reasoner.exec(options, file)
ctu({ success: explanation })

ctu(explanation)
})
})
} catch(e) {
console.log(e)
ctu({ error: e })

} finally {
await tmp.del(file)
}
}

function doImperating(options, ctu) {
tmp.save(options.formula, (file) => {
async function doImperating(options, ctu) {
let file
try {
file = await tmp.save(options.formula)

const reasoner = jen3;
const code = await reasoner.exec(options, file)
ctu({ success: code })

} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(file)
}
}

var reasoner = jen3;
reasoner.exec(options, file, (code) => {
tmp.del(file)
async function doTriplify(options, ctu) {
let file
try {
file = tmp.save(options.formula)

ctu(code)
})
})
const code = await triplify.exec(options, file)
ctu({ success: code })

} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(file)
}
}

async function doQuery(options, ctu) {
let data, query
try {
data = await tmp.save(options.data)
query = await tmp.save(options.query)

let engine = null;
switch (options.system) {

case "jena":
engine = jena
break

default:
throw `unsupported system: "${options.system}"`
}

const output = await engine.exec(options, data, query)
ctu({ success: output })

} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(data)
await tmp.del(query)
}
}

async function doSpin3(options, ctu) {
let data, query
try {
data = await tmp.save(options.data)
query = await tmp.save(options.query)

const output = await spin3.exec(options, data, query);
ctu({ success: output })

} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(data)
await tmp.del(query)
}
}

function doGenerateLink(options, ctu) {
Expand All @@ -166,24 +271,28 @@ function doGenerateLink(options, ctu) {

function doResolveLink(options, ctu) {
resolveLink(options.id)
.then((data) => {
.then((data) => {
// console.log("resolved link:", data);
ctu({ success: data })
})
.catch((error) => { ctu({ error: error }) })
}

function doCheckBuiltinInput(options, ctu) {
tmp.save(options.definitions, (defFile) => {
tmp.save(options.test, (testFile) => {
async function doCheckBuiltinInput(options, ctu) {
let defFile, testFile
try {
defFile = await tmp.save(options.definitions)
testFile = await tmp.save(options.test)

function end(ret) {
tmp.del(defFile)
tmp.del(testFile)
ctu(ret)
}
const output = await checkBuiltinInput(defFile, testFile)
ctu({ success: output })

checkBuiltinInput(defFile, testFile, end)
})
})
} catch (e) {
console.log(e)
ctu({ error: e + "" })

} finally {
await tmp.del(defFile)
await tmp.del(testFile)
}
}
44 changes: 28 additions & 16 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
config = {
http: {
hostname: 'http://127.0.0.1',
port: 3002
hostname: 'https://n3-editor.herokuapp.com',
port: ((typeof process) != "undefined" ? process.env.PORT : undefined)
},

reasoners: {
out: "/app/out",

tools: {
eye: {
exec: "/Users/wvw/git/n3/n3-editor-js/opt/eye/bin/eye",
folder: "/Users/wvw/git/n3/n3-editor-js/lib/eye"
exec: "eye",
folder: "/app/lib/eye"
},
cwm: {
// (use python2 for cwm)
pythonCmd: "python",
exec: "/Users/wvw/cwm-1.2.1/swap/cwm.py"
pythonCmd: "", // (python2 is not available)
exec: ""
},
jen3: {
exec: "/Users/wvw/git/n3/n3-editor-js/lib/jen3/jen3.jar",
codegen: "/Users/wvw/git/n3/n3-editor-js/lib/jen3/codegen.jar",
folder: "/Users/wvw/git/n3/n3-editor-js/lib/jen3"
}
exec: "/app/lib/jen3/jen3.jar",
codegen: "/app/lib/jen3/codegen.jar",
folder: "/app/lib/jen3"
},
jena: {
exec: "/app/lib/jena/sparql.jar",
},
triplify: {
exec: "/app/lib/triplify/sparql2spin.jar"
},
spin3: {
folder: "/app/lib/spin3"
},
},

link: {
max_len: 50000,
db: {
// mysql://b4837d17c012f1:[email protected]/heroku_e750abd160bbcaf?reconnect=true
port: '33060',
host: 'localhost',
db: "n3_links",
user: 'root',
pwd: ''
host: "us-cdbr-east-06.cleardb.net",
db: "heroku_e750abd160bbcaf",
user: "b4837d17c012f1",
pwd: "e023e78d"
}
},

path: "/Users/wvw/git/n3/n3-editor-js"
path: "/Users/wvw/git/n3/n3-editor-js" // ??
}

if (typeof exports === 'object' && typeof module === 'object')
Expand Down
Loading