-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
81 lines (71 loc) · 2.9 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<p id="root">You should see a list of synonyms here</p>
<script type="module">
import SynoGroup, { SparqlEndpoint } from "./synonym-group.js";
const sparqlEndpoint = new SparqlEndpoint("https://treatment.ld.plazi.org/sparql")
const taxonName = "Artema atlanta";
const synoGroup = new SynoGroup(sparqlEndpoint, taxonName);
const root = document.getElementById("root")
root.innerHTML = `<h1>Synonym Group For ${taxonName}</h1>`;
for await (const synonym of synoGroup) {
const synElem = document.createElement("div");
root.appendChild(synElem);
synElem.innerHTML = `<h2>${synonym.taxonConceptUri}</h2>
Justifications:
<ul class="justification-list"></ul>
Treatments:
<ul class="treatment-list"></ul>
`;
const justListElem = synElem.getElementsByClassName("justification-list")[0];
const treatListElem = synElem.getElementsByClassName("treatment-list")[0];
(async () => {
for await (const justification of synonym.justifications) {
const justElem = document.createElement("li");
justElem.innerHTML = `${justification}`
justListElem.appendChild(justElem)
}
})();
(async () => {
for (const treatment of synonym.treatments.aug) {
const treatElem = document.createElement("li");
treatElem.innerHTML = `Aug. by: ${treatment.url}`
treatListElem.appendChild(treatElem)
if ((await treatment.details).materialCitations?.length > 0) {
treatElem.append(" · Cites: ", (await treatment.details).materialCitations.map(mc => mc.catalogNumber).join(", "))
}
}
})();
(async () => {
for (const treatment of synonym.treatments.def) {
const treatElem = document.createElement("li");
treatElem.innerHTML = `Def. by: ${treatment.url}`
treatListElem.appendChild(treatElem)
if ((await treatment.details).materialCitations.length > 0) {
treatElem.append(" · Cites: ", (await treatment.details).materialCitations.map(mc => mc.catalogNumber).join(", "))
}
}
})();
(async () => {
for (const treatment of synonym.treatments.dpr) {
const treatElem = document.createElement("li");
treatElem.innerHTML = `Dpr. by: ${treatment.url}`
treatListElem.appendChild(treatElem)
if ((await treatment.details).materialCitations.length > 0) {
treatElem.append(" · Cites: ", (await treatment.details).materialCitations.map(mc => mc.catalogNumber).join(", "))
}
}
})();
}
</script>
</body>
</html>