-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_vsm_box_pubdictionaries.html
84 lines (77 loc) · 3.03 KB
/
test_vsm_box_pubdictionaries.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
<!DOCTYPE html>
<html lang="English">
<head>
<title>vsm-box + PubDictionaries example</title>
<!-- <script src="../dist/vsm-pubdictionaries.min.js"></script> -->
<!-- To use the above line, run first `npm build`. The below line can be used anytime :) -->
<script src="https://unpkg.com/vsm-pubdictionaries@^1.0.0/dist/vsm-pubdictionaries.min.js"></script>
<script src="https://unpkg.com/vsm-dictionary-rnacentral@^1.0.1/dist/vsm-dictionary-rnacentral.min.js"></script>
<script src="https://unpkg.com/vsm-dictionary-cacher@^1.2.0/dist/vsm-dictionary-cacher.min.js"></script>
<script src="https://unpkg.com/vsm-dictionary-combiner@^1.0.1/dist/vsm-dictionary-combiner.min.js"></script>
<script src="https://unpkg.com/vsm-box@^1.0.0/dist/vsm-box.standalone.min.js"></script>
</head>
<body>
<vsm-box autofocus=true></vsm-box>
</body>
<script>
// initialize vsm-pubdictionaries
let VsmPubDict = new VsmPubDictionaries({log: true, suggest: 'substring'});
let VsmDictRNAcentral = new VsmDictionaryRNAcentral({log: true});
// initialize a cached version of the combiner
let VsmDictionaryCombinerCached = VsmDictionaryCacher(VsmDictionaryCombiner, { predictEmpties: false });
let dictionary = new VsmDictionaryCombinerCached({
// Give all required dictionaries as initialized Objects in this array
dictionaries: [
VsmPubDict, VsmDictRNAcentral
],
errorIfAllErrors: true
});
let vsmbox = document.getElementsByTagName('vsm-box')[0];
let queryOptions = { perPage: 10 };
let initialValue = {
terms: [
{ placeholder: 'person',
queryOptions: {
filter: { dictID: [ 'http://pubdictionaries.org/dictionaries/demo-Persons' ] }
},
},
{ placeholder: 'activity',
queryOptions: {
filter: { dictID: [ 'http://pubdictionaries.org/dictionaries/demo-Relations' ] }
},
str: 'eats', descr: '=an eating activity', classID: null, instID: null
},
{ placeholder: 'food',
queryOptions: {
filter: {
dictID: [
'http://pubdictionaries.org/dictionaries/demo-Food',
'http://pubdictionaries.org/dictionaries/demo-Animals'
]},
// uncomment the next line to get the results from the food dictionary first
// sort: { dictID: [ 'http://pubdictionaries.org/dictionaries/demo-Food' ]}
},
},
{ placeholder: 'activity',
queryOptions: {
filter: { dictID: [ 'http://pubdictionaries.org/dictionaries/demo-Relations' ] }
},
str: 'with', descr: '=using, =use of', classID: null, instID: null
},
{ placeholder: 'tool',
queryOptions: {
filter: { dictID: [ 'http://pubdictionaries.org/dictionaries/demo-Tools' ] }
},
}
],
conns: [
{ type: 'T', pos: [ 0, 1, 2 ] },
{ type: 'T', pos: [ 1, 3, 4 ] },
]
};
vsmbox.vsmDictionary = dictionary;
vsmbox.initialValue = initialValue;
vsmbox.queryOptions = queryOptions;
vsmbox.sizes = { minWidth: 400 };
</script>
</html>