-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
executable file
·109 lines (94 loc) · 3.18 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
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.9/css/all.css" integrity="sha384-5SOiIsAziJl6AWe0HWRKTXlfcSHKmYV4RBF18PPJ173Kzn7jzMyFuTtk8JA7QQG1" crossorigin="anonymous">
<title>TEST</title>
</head>
<body>
<div width="500" height="600" id="mycontainer" ></div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js" integrity="sha512-vRqhAr2wsn+/cSsyz80psBbCcqzz2GTuhGk3bq3dAyytz4J/8XwFqMjiAGFBj+WM95lHBJ9cDf87T3P8yMrY7A==" crossorigin="anonymous"></script>
<!-- <script type="text/javascript" src="/d3.min.js"></script>
<script type="text/javascript" src="/terminusdb-client.min.js"></script>
<script type="text/javascript" src="/GraphResultsViewer.js"></script>-->
<script>
require.config({
paths: {
// d3: 'd3.min',
TerminusClient:'https://dl.bintray.com/terminusdb/terminusdb/dev/terminusdb-client.min',
TerminusDBGraph:'https://dl.bintray.com/terminusdb/terminusdb/dev/terminusdb-d3-graph.min'
}
});
require(['d3','TerminusClient','TerminusDBGraph'], function(d3,TerminusClient,TerminusDBGraph){
const resultData={
"@type":"api:WoqlResponse",
"api:status":"api:success",
"api:variable_names": [
"Person",
"Name",
"Mother",
"Mother_Name",
"Mother_DOB",
"GranMother_Name"
],
"bindings": [
{
"GranMother_Name":"system:unknown",
"Mother":"terminusdb:///data/Person_Maria_1945-12-03",
"Mother_DOB": {
"@type":"http://www.w3.org/2001/XMLSchema#date",
"@value":"1945-12-03"
},
"Mother_Name": {
"@type":"http://www.w3.org/2001/XMLSchema#string",
"@value":"Maria"
},
"Name": {
"@type":"http://www.w3.org/2001/XMLSchema#string",
"@value":"Anna"
},
"Person":"terminusdb:///data/Person_Anna_1974-02-10"
},
{
"GranMother_Name":"terminusdb:///data/Person_Maria_1945-12-03",
"Mother":"terminusdb:///data/Person_Anna_1974-02-10",
"Mother_DOB": {
"@type":"http://www.w3.org/2001/XMLSchema#date",
"@value":"1974-02-10"
},
"Mother_Name": {
"@type":"http://www.w3.org/2001/XMLSchema#string",
"@value":"Anna"
},
"Name": {
"@type":"http://www.w3.org/2001/XMLSchema#string",
"@value":"Emily"
},
"Person":"terminusdb:///data/Person_Emily_2011-06-23"
},
{
"GranMother_Name":"system:unknown",
"Mother":"system:unknown",
"Mother_DOB":"system:unknown",
"Mother_Name":"system:unknown",
"Name": {
"@type":"http://www.w3.org/2001/XMLSchema#string",
"@value":"Maria"
},
"Person":"terminusdb:///data/Person_Maria_1945-12-03"
}
],
"deletes":0,
"inserts":0,
"transaction_retry_count":0
}
const woqlGraphConfig= new TerminusClient.View.graph();
woqlGraphConfig.height(500).width(800)
var result = new TerminusClient.WOQLResult(resultData);
let viewer = woqlGraphConfig.create(null);
viewer.setResult(result);
const graphResult= new TerminusDBGraph.GraphResultsViewer(viewer.config, viewer);
graphResult.load("#mycontainer",true);
})
</script>
</html>