This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
validator.html
199 lines (180 loc) · 10.3 KB
/
validator.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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="emacs" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="author" content="Eric Prud'hommeaux ([email protected])" />
<meta name="copyright" content="Copyright © 2013 Eric Prud'hommeaux" />
<meta name="keywords" content="schema validator, Turtle" />
<meta name="description" content="This is a validator for dataset descriptions conforming to the HCLS specification. It is based on the Shape Expression work of Eric Prud'hommeaux" />
<title>HCLS Validator</title>
<link rel="stylesheet" href="validator.css" type="text/css" />
<style type="text/css">
.hilightSolution { background-color: #fea; }
.hilightRule { border-top: 1px solid #8fc; border-bottom: 1px solid #8fc; border-left: .25em solid #8fc; border-right: .25em solid #8fc; background-color: #fea; }
.hilightData { border-top: 1px solid #7bf; border-bottom: 1px solid #7bf; border-left: .25em solid #7bf; border-right: .25em solid #7bf; background-color: #fea; }
.remainingData { background-color: #dae; }
.schemaflow { border-top: 1px solid #8fc; border-bottom: 1px solid #8fc; border-left: .25em solid #8fc; border-right: .25em solid #8fc; }
.schemapre { border:.5em solid #7fb; }
.dataflow { border-top: 1px solid #7bf; border-bottom: 1px solid #7bf; border-left: .25em solid #7bf; border-right: .25em solid #7bf; }
.datapre { border:.5em solid #7bf; }
.solution { border-top: 1px solid #fb7; border-bottom: 1px solid #fb7; border-left: .25em solid #fb7; border-right: .25em solid #fb7; }
.inputBox { float:left; margin: .5em; }
.textButton { background-color: #ddd; border: 1px solid #000; }
.preload { float:left; border:3px solid #efe; margin-left: 1em;}
.preload-desc { float:left; border:3px solid #fff; text-align: right;}
.IRI { color: #00f; }
.bnode { color: #a3a; }
.literal { color: #722; }
.rule { color: #119; }
.code { color: #7bb; }
.comment { color: #191; }
.error { color: #d00; }
</style>
<link rel="shortcut icon" href="shortcut.ico" type="image/x-icon" />
</head>
<body>
<noscript>
<div id="apology">Sorry, this validator needs javascript.</div>
</noscript>
<div id="main">
<h1>HCLS Dataset Description Validator</h1>
<ul>
<li><a href="hcls-validator.shex">Validator rules</a></li>
<li><a href="validator.html?url=chembl-description.ttl">ChEMBL example</a></li>
<li>Report an <a href="https://github.com/AlasdairGray/HCLSValidator/issues">issue</a></li>
</ul>
<div id="schema" style="width=100%; ">
<div>
<h2 class="task schema">Schema Status:</h2>
<div class="message progress">Preparing to parse schema.</div>
<div style="clear:both;"></div>
</div>
<textarea class="textInput" cols="70" rows="1" style="display:none;" contenteditable="false"></textarea>
<div class="editparent"><pre class="textInput" contenteditable="false" style="display:none; overflow:scroll !important; "></pre></div>
<input class="save" value=""></input>
</div>
<div id="data" class="column">
<div>
<h2 class="task data">Data (Turtle):</h2>
<div class="message progress">Preparing to parse data.</div>
<div style="clear:both;"></div>
</div>
<input type="file" id="fileinput" /><br/>
<textarea class="textInput" id="rdfDescription" cols="70" rows="20"></textarea>
<div class="editparent"><pre class="textInput" contenteditable="true" style="display:none; overflow:scroll !important; "></pre></div>
<input class="save" value=""></input>
</div>
<div class="column">
<div id="validation">
<h2 id="validation-label" class="task validation">Validation Settings:</h2>
<div style="clear:both; padding-left:5em" id="colorize">
<input type="checkbox" id="ctl-colorize" tabindex="9"/> <label for="ctl-colorize"><span style="color: #700;">c</span><span style="color: #510;">o</span><span style="color: #330;">l</span><span style="color: #150;">o</span><span style="color: #070;">r</span><span style="color: #051;">i</span><span style="color: #033;">z</span><span style="color: #015;">e</span><span style="color: #007;">d</span></label>
</div>
<div style="clear:both;">
<div id="settings">
<div id="options">
<input type="radio" name="mode" id="opt-find-type" value="find-type" checked="checked" /> <label for="opt-pre-typed">Find node types</label><br/>
<input type="radio" name="mode" id="opt-pre-typed" value="pre-typed" />
<label for="opt-pre-typed">Pre-typed</label>
<label for="starting-node">graph node:</label>
<input type="text" id="starting-node" value="???" disabled="disabled" />
</div>
</div>
<!--
<div style="float:left">View as </div>
<div id="view" style="padding-left: .2em; float:left">
<a id="as-sparql-query" class="disabled" href="#">SPARQL query</a><br/>
<a id="as-remaining-triples" class="disabled" href="#">SPARQL remaining triples</a><br/>
<a id="as-resource-shape" class="disabled" href="#">Resource Shape</a>
<a id="as-resource-sexpr" class="disabled" href="#">S-Expression</a>
</div>
<div id="permalink">
<a href="#">permalink</a> <input type="checkbox" id="ctl-keep-history"/> <label for="ctl-keep-history">add to history</label>
</div>
-->
</div>
<h2 id="validation-header" style="clear:both">Validation messages:</h2>
<pre id="validation-messages" class="disabled">unexpected state</pre>
</div>
<!-- div style="clear:both" id="ch">
<pre class="changeable" contenteditable="true">edit me</pre>
</div -->
</div>
<div style="clear:both">
<h2 style="color: #330;" id="valResults-header">Validation Results</h2>
<pre id="valResults" class="disabled">unexpected state.</pre>
</div>
</div>
<div style="display:none"><!-- some state -->
<input id="curRule" type="text" size="1" value="-1"></input><br/>
<input id="curSolution" type="text" size="1" value="-1"></input><br/>
<input id="curData" type="text" size="1" value="-1"></input><br/>
</div>
<script src="js/jquery.min.js" type= "text/javascript"></script>
<script src="js/jquery.contenteditable.js" type="text/javascript"></script>
<script src="js/webtoolkit.base64.js" type="text/javascript"></script>
<script src="RDF.js" type="text/javascript"></script>
<script src="ShExParser.js" type="text/javascript"></script>
<script src="TurtleParser.js" type="text/javascript"></script>
<script src="js/ShExDemo.js" type="text/javascript"></script>
<script src="hcls-validator.js" type="text/javascript"></script>
<script type="text/javascript">
var rdfTextarea = 'rdfDescription';
document.getElementById(rdfTextarea).placeholder="Paste in RDF or select from file.";
var d = false;
var interactionInterface = ShExDemo(RDF);
window.message = interactionInterface.message;
RDF.message = function (m) {
interactionInterface.message(m);
}
$("#apology").text("Starting javascript libraries...");
$(document).ready(function () {
try {
interactionInterface.loadAndStart();
} catch (e) { // Sigh, exceptions ajax callbacks never get here.
$("#apology").text("Error running javascript libraries: " + e);
}
});
//Read parameters from request
var params = getQueryParams(document.location.search);
if (params.url != null) {
//Set textarea content to value read from URL retrieved
var url = params.url;
document.getElementById(rdfTextarea).value=getExternalText(url);
}
function readFile(evt) {
// Check for the various File API support.
if (window.File && window.FileReader && window.FileList && window.Blob) {
// Great success! All the File APIs are supported.
//Retrieve the first (and only!) File from the FileList object
var f = evt.target.files[0];
if (f) {
var r = new FileReader();
r.onload = function(e) {
var contents = e.target.result;
document.getElementById(rdfTextarea).value=contents;
interactionInterface.parseData();
interactionInterface.validator;
interactionInterface.validate();
}
r.readAsText(f);
} else {
alert("Failed to load file");
}
} else {
alert('The File APIs are not fully supported in this browser.');
}
}
document.getElementById('fileinput').addEventListener('change', readFile, false);
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1275107-7', 'hw.ac.uk');
ga('send', 'pageview');
</script>
</body>
</html>