generated from jeswr/template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbrowser.html
35 lines (28 loc) · 939 Bytes
/
browser.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
<!DOCTYPE html>
<html>
<body>
<textarea id="data" rows="10" cols="75">
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix : <http://example.org/socrates#>.
:Socrates a :Human.
:Human rdfs:subClassOf :Mortal.
{?A rdfs:subClassOf ?B. ?S a ?A} => {?S a ?B}.</textarea
>
<button id="execute">Execute</button>
<button id="clear">Clear</button>
<div id="result"></div>
</body>
<script src="/index.js"></script>
<script>
document.getElementById('execute').addEventListener("click", async () => {
document.getElementById("result").innerHTML = (await eyereasoner.n3reasoner(
document.getElementById("data").value,
undefined,
{ output: 'derivations' }
)).replaceAll('\n', '<br>');
});
document.getElementById('clear').addEventListener("click", async () => {
document.getElementById("result").innerHTML = '';
});
</script>
</html>