-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
166 lines (154 loc) · 5.8 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>ELAG ETL Lab</title>
<link rel="stylesheet" href="http://lib.thedatatank.com/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://datatank.demo.ibbt.be/installer/static/main.css" />
<link rel="stylesheet" href="lib/codemirror.css" />
<script src="http://datatank.demo.ibbt.be/The-Semantifier/lib/jquery-1.7.1.min.js"></script>
<script src="lib/codemirror.js"></script>
<script src="mode/turtle/turtle.js"></script>
</head>
<body>
<div id="masterhead" class="container">
<div class="row">
<div class="columns"><img src="http://datatank.demo.ibbt.be/installer/static/logo.png"/>
</div>
</div>
</div>
<div id="main">
<div class="container">
<p id="input">Input row in<br/><select id="format" name="type">
<option value="CSV_0">CSV with header row and ; as a delimiter</option>
<option value="CSV_1">CSV with header row and , as a delimiter</option>
<option value="CSV_2">CSV without header row and ; as a delimiter</option>
<option value="CSV_3">CSV without header row and , as a delimiter</option>
<option value="JSON">JSON</option>
<option value="XML">XML</option></select></p>
<p>
<textarea name="input" cols="100" rows="20" style="width: 99.5%; height: 110px;" id="source">
name;long;lat
poi1;3.14159;51.2
</textarea>
</p>
<p>Mapping file (<a href="https://github.com/mielvds/Vertere-RDF/blob/master/documentation/README.md" target="_blank">how to?</a>)</p>
<textarea name="fix" cols="100" rows="10" style="width: 99.5%; height: 110px;" id="mapping">
@prefix : <http://example.com/schema/data_conversion#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix schema: <http://schema.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix transit: <http://vocab.org/transit/terms/> .
<#> a :Spec
; :base_uri "http://example.com/"
; :resource <#Poi>
.
<#Poi> a :Resource
; :type schema:TouristAttraction
; :identity [
:source_column "name";
]
; :attribute
[ :property geo:lon; :source_column "long" ],
[ :property geo:lat; :source_column "lat" ] .
</textarea>
<div id="error" style="display:none; color:red; font-style: italic">
</div>
<input type="submit" id="submit1">
<p>Output<br><i>turtle</i></p>
<textarea readonly="readonly" name="output" cols="100" rows="20" style="width: 99.5%; height: 110px;" id="result"></textarea>
</div>
</div>
<footer>
<div class="footer" align="center">
© 2013 <a href="http://npo.irail.be" target="_blank">OKFN Belgium</a> - Powered by <a href="http://thedatatank.com" target="_blank">The DataTank</a>
</div>
</footer>
<script>
$(function(){
var editor = document.getElementById("mapping");
var myCodeMirror = CodeMirror.fromTextArea(editor);
// some jquery magic
$("#submit1").click(function(){
var extract = {};
switch($("#format").val()){
case "CSV_0":
extract = {
"type": "CSV",
"delimiter": ";",
"has_header_row": "1"
}
break;
case "CSV_1":
extract = {
"type": "CSV",
"delimiter": ",",
"has_header_row": "1"
}
break;
case "CSV_2":
extract = {
"type": "CSV",
"delimiter": ";",
"has_header_row": "0"
}
break;
case "CSV_3":
extract = {
"type": "CSV",
"delimiter": ",",
"has_header_row": "0"
}
break;
case "JSON":
extract = {
"type": "JSON"
}
break;
case "XML":
extract = {
"type": "XML"
}
break;
default:
}
//validation URI: http://www.rdfabout.com/demo/validator/validate.xpd
//POST {format: "n3", content: "" }
/*var validation_config = {format: "n3", content: myCodeMirror.getValue() };
$.ajax({
type: "POST",
url: "http://www.rdfabout.com/demo/validator/validate.xpd",
data: validation_config,
success: function(data, status){
$("#error").html(data);
},
error : function(data){
$("#error").html(data);
}
});*/
var config = {
"mapping": myCodeMirror.getValue(),
"extract": extract,
"chunk": $('#source').val()
};
$.ajax({
type: "POST",
url: "http://demo.thedatatank.org/tdtinput/test",
data: JSON.stringify(config),
success: function(data, status){
$("#error").hide();
$("#result").val(data);
},
error : function(data){
$("#error").html(data || "An error occurred in the mapping. Please check your mapping file for errors.").show();
}
});
});
});
</script>
</body>
</html>