-
Notifications
You must be signed in to change notification settings - Fork 1
/
count_ressources.html
66 lines (59 loc) · 1.9 KB
/
count_ressources.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Count Ressources</title>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/gh/p2m2/[email protected]/dist/discovery-web.min.js">
</script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css"
>
<style>
.icon {
font-size: 2em;
}
</style>
<body>
<div id="icon-container">
<i id="status-icon" class="icon fas fa-spinner fa-spin"></i>
</div>
<div id="status-message">En attente...</div>
</body>
<script>
var config = SWDiscoveryConfiguration
.init()
.urlFile("https://raw.githubusercontent.com/p2m2/tp-discovery-websempilot/main/rdf/triples_assos_CID_MESH_sub.ttl");
SWDiscovery(config)
.something("allRessources")
.select("allRessources")
.commit()
.raw()
.then((response) => {
message = "count: "+response.results.bindings.length ;
isOK(message)
}
).catch( (error) => {
isKO(error)
} );
function isOK(message){
const iconElement = document.getElementById('status-icon');
const messageElement = document.getElementById('status-message');
iconElement.className = 'icon fas fa-check-circle';
iconElement.style.color = 'green';
messageElement.innerHTML = message;
messageElement.style.color = 'green';
}
function isKO(error){
const iconElement = document.getElementById('status-icon');
const messageElement = document.getElementById('status-message');
iconElement.className = 'icon fas fa-times-circle';
iconElement.style.color = 'red';
messageElement.textContent = error.message;
messageElement.style.color = 'red';
}
</script>
</html>