forked from academicpages/academicpages.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_v1.txt
181 lines (165 loc) · 5.94 KB
/
index_v1.txt
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SCOOP</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f7f7f7;
margin: 0;
padding: 0;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
min-height: 100vh;
}
.banner {
width: 100%;
padding: 2px 0;
background-color: #6a1b9a; /* Purple color */
color: #fff;
text-align: center;
margin-bottom: 20px;
}
.container {
width: 90%;
max-width: 800px;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
text-align: center;
}
h1 {
color: #007bff;
}
h2 {
color: #555;
}
textarea {
width: calc(100% - 22px); /* Adjusted width */
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
resize: vertical;
}
input[type="file"] {
margin-top: 5px;
}
button {
display: inline-block;
padding: 10px 20px;
background-color: #ffc107;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #ffca28;
}
#shaclOutput {
width: calc(100% - 22px); /* Adjusted width */
height: 150px;
margin-top: 20px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
resize: vertical;
}
</style>
</head>
<body>
<div class="banner">
<p>Welcome to SCOOP</p>
</div>
<div class="container">
<h1>SCOOP</h1>
<div style="display: flex; justify-content: space-around;">
<div>
<h2>Raw data schema</h2>
<textarea id="xsdText" rows="5" placeholder="Enter raw data schema here"></textarea>
<input type="file" id="xsdTextFile" accept=".txt,.json" onchange="handleFileUpload(this)">
</div>
<div>
<h2>RML mapping rules</h2>
<textarea id="rmlText" rows="5" placeholder="Enter RML mapping rules here"></textarea>
<input type="file" id="rmlTextFile" accept=".ttl" onchange="handleFileUpload(this)">
</div>
<div>
<h2>Ontology</h2>
<textarea id="owlText" rows="5" placeholder="Enter ontology here"></textarea>
<input type="file" id="owlTextFile" accept=".txt,.owl,.ttl" onchange="handleFileUpload(this)">
</div>
</div>
<div>
<h2>SHACL Output</h2>
<textarea id="shaclOutput" rows="5" placeholder="SHACL output will appear here" readonly></textarea>
</div>
<button onclick="translateIt()">Translate to SHACL</button>
</div>
<script>
function handleFileUpload(input) {
const file = input.files[0];
const reader = new FileReader();
reader.onload = function(e) {
const textAreaId = input.id.replace('File', '');
document.getElementById(textAreaId).value = e.target.result;
}
reader.readAsText(file);
}
function translateIt() {
var formData = new FormData();
formData.append('xsdData', document.getElementById('xsdText').value);
formData.append('rmlData', document.getElementById('rmlText').value);
formData.append('owlData', document.getElementById('owlText').value);
// var rawDataSchema = document.getElementById('rawDataSchema').value;
// var rmlMappingRules = document.getElementById('rmlMappingRules').value;
// var ontologyContent = document.getElementById('ontology').value;
// Send POST request to backend
fetch('/translate', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
// Handle the response from backend
console.log('SHACL output:', data);
// document.getElementById('shaclOutput').innerText = JSON.stringify(data, null, 2);
document.getElementById('shaclOutput').innerText = data.shacl_output;
// Update your HTML elements with the SHACL output
})
.catch(error => {
console.error('Error:', error);
});
// var apiUrl = 'https://astrea.linkeddata.es/api/shacl/url';
// // var requestBody = {
// // "ontology": ontologyContent,
// // "serialisation": "TURTLE"
// // };
// var requestBody = {"ontologies": ["https://www.w3.org/2006/time#"]}
// fetch(apiUrl, {
// // mode: 'no-cors',
// method: 'POST',
// headers: {
// "Access-Control-Allow-Origin": "http://localhost:3000",
// 'Content-Type': 'application/json'
// },
// body: JSON.stringify(requestBody)
// })
// .then(response => response.json())
// .then(data => {
// document.getElementById('shaclOutput').value = data;
// })
// .catch(error => {
// console.error('Error:', error);
// });
}
</script>
</body>
</html>