-
Notifications
You must be signed in to change notification settings - Fork 265
Expand file tree
/
Copy pathbrowser_runner.html
More file actions
73 lines (58 loc) · 1.84 KB
/
browser_runner.html
File metadata and controls
73 lines (58 loc) · 1.84 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="node_modules/diff/dist/diff.min.js"></script>
<script src="node_modules/rdflib/dist/rdflib.min.js"></script>
<script>
window.onload = () => {
(async () => {
let web = await import("./web_parser.js");
web.init();
let test ={
"file":"data/sioc.rdf",
"compare":"sorted_data/sioc_sorted.json",
"baseIri": "http://rdfs.org/sioc/ns#",
"iriMap": {
}
}
;
async function getData(file) {
const response = await fetch(file);
if (!response.ok)
throw new Error("cannot fetch file: " + file);
return await response.text();
}
try {
const ext = test.file.substr(test.file.lastIndexOf(".") + 1);
const data = await getData(test.file);
var compare = (await getData(test.compare)).trim();
var result = await parser.transform(data, test.baseIri, parser.getMime(ext), getLoader(test.iriMap));
result._comment = "Created with OWL2VOWL (version 0.3.7), http://vowl.visualdataweb.org";
result = JSON.stringify(sorter.sort(result), null, 2).trim();
const diff = Diff.structuredPatch("parsed", "orig", result, compare);
if(diff.hunks.length)
throw new Error(Diff.formatPatch(diff));
console.log(test.file + ": ok");
} catch(err){
console.log("test for " + test.file + " failed with:");
//if(!result)
console.log(err);
console.log(result);
/*
let other = JSON.parse(compare);
result = JSON.parse(result);
for(let prop of result.property) {
console.log(prop.type, result.propertyAttribute[prop.id].iri)
}
for(let prop of other.property) {
console.log(prop.type, other.propertyAttribute[prop.id].iri)
}
*/
}
})();
}
</script>
</head>
<body></body>
</html>