-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi.js
34 lines (30 loc) · 1.03 KB
/
api.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
33
34
const fs = require('fs'),
path = require('path'),
express = require('express'),
router = express.Router()
const Knowledge = require('./knwl').Knowledge
const knwl = new Knowledge('http://dbpedia.org/ontology')
router.get('/', async (req, res, next) => {
res.json(true)
})
router.post('/getClass', async (req, res, next) => {
const name = req.body.name
const includeProps = req.body.includeProps || false
const found = await knwl.getClass(name, includeProps)
res.json(found ? found.toJson() : null)
})
router.get('/getSimplifiedOntologyGraph', async (req, res, next) => {
const found = await knwl.getSimplifiedOntologyGraph()
res.json(found)
})
router.get('/getDataPropertyUrisOfClass', async (req, res, next) => {
const name = req.body.name
const found = await knwl.getDataPropertyUrisOfClass(name)
res.json(found)
})
router.get('/getObjectPropertyUrisOfClass', async (req, res, next) => {
const name = req.body.name
const found = await knwl.getObjectPropertyUrisOfClass(name)
res.json(found)
})
module.exports = router