-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
157 lines (115 loc) · 4.06 KB
/
test.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
process.env.npm_package_config_ONTOLOGY_PREFIX = '<http://community.infineon.com/sites/smart-FA-lab/Semantic%20Search/FAOntologyV5#>';
process.env.npm_package_config_FUSEKI_URI = 'http://127.0.0.1:3030/FAOntology';
process.env.npm_package_config_FUSEKI_AUTH = 'Basic YWRtaW46YWRtaW4=';
const connectionTypes = require('./../ConnectionTypes').all;
async function main () {
await test_query_tasks_methods();
await test_query_tasks();
await test_query_connections();
await test_update_task_names();
await test_delete_connections();
await test_delete_tasks();
await test_insert_tasks();
await test_insert_connections();
}
async function test_query_tasks_methods() {
const { createQuery, rowAccFn } = require('./query_tasks_methods');
const query = createQuery();
console.log('test_query_tasks_methods')
console.log()
// console.log(await query)
const tasks = await require('./query')(await query, rowAccFn);
console.dir(tasks);
console.log('end')
console.log()
}
async function test_query_tasks() {
const { createQuery, rowAccFn } = require('./query_tasks');
const query = createQuery();
console.log('test_query_tasks')
console.log()
// console.log(await query)
const tasks = await require('./query')(await query, rowAccFn);
console.dir(tasks);
console.log('end')
console.log()
}
async function test_query_connections() {
const { createQuery, rowAccFn } = require('./query_connections');
const query = createQuery();
console.log('test_query_connections')
console.log()
// console.log(await query)
const connections = await require('./query')(await query, rowAccFn);
console.dir(connections);
console.log('end')
console.log()
}
async function test_update_task_names() {
const updateSubjects = require('./update_subject_tasks')
({importedName: 'EVI', name: 'EVI2'});
const updateObjects = require('./update_object_tasks')
({importedName: 'EVI', name: 'EVI2'});
console.log('test_update_task_names')
console.log()
// console.log(await updateSubjects + ';' + await updateObjects)
await require('./update')(await updateSubjects, await updateObjects);
console.log('end')
console.log()
}
async function test_delete_tasks() {
const updateSubjects = require('./delete_subject_tasks.js')
({name: 'XRAY'});
const updateObjects = require('./delete_object_tasks.js')
({name: 'XRAY'});
console.log('test_delete_tasks')
console.log()
// console.log(await updateSubjects + ';' + await updateObjects)
await require('./update')(await updateSubjects, await updateObjects);
console.log('end')
console.log()
}
async function test_delete_connections() {
const updateConnections = require('./delete_connections.js')(...connectionTypes);
console.log('test_delete_connections')
console.log()
// console.log(await updateConnections)
await require('./update')(await updateConnections)
console.log('end')
console.log()
}
async function test_insert_tasks() {
const insertTasks = require('./insert_tasks.js')(
{name: 'XRAY', group: 'non-destructive', repeatable: false},
{name: 'EVI', group: 'non-destructive', repeatable: false}
);
console.log('test_insert_tasks')
console.log()
// console.log(await insertTasks)
await require('./update')(await insertTasks)
console.log('end')
console.log()
}
async function test_insert_connections() {
const insertConnections = require('./insert_connections.js')
({srcName: 'XRAY', name: 'has_predecessor', dstName: 'EVI', transitive: false});
console.log('test_insert_connections')
console.log()
// console.log(await insertConnections)
await require('./update')(await insertConnections)
console.log('end')
console.log()
}
// const rdf = require('rdf-ext')
// const SparqlClient = require('sparql-http-client')
// const local = new SparqlClient({
// storeUrl: 'http://localhost:3030/FAOntology/data',
// factory: rdf
// })
// async function main () {
// const stream = await local.store.get(rdf.defaultGraph())
// stream.on('data', quad => {
// console.log(`${quad.subject} ${quad.predicate} ${quad.object}`)
// })
// }
main()