1+
2+ var dbClient = new TerminusClient . WOQLClient ( ) ;
3+ var connection = dbClient . connect ( "http://195.201.12.87:6365/" , "connectors wanna plans compressed" , "rational_warehouse" ) ;
4+
5+ var WOQL = TerminusClient . WOQL ;
6+
7+ ( function ( ) {
8+ var fileCatcher = document . getElementById ( 'file-catcher' ) ;
9+ var fileInput = document . getElementById ( 'file-input' ) ;
10+ var fileListDisplay = document . getElementById ( 'file-list-display' ) ;
11+
12+ var fileList = [ ] ;
13+ var renderFileList , sendFile ;
14+
15+ fileCatcher . addEventListener ( 'submit' , function ( evnt ) {
16+ evnt . preventDefault ( ) ;
17+ fileList . forEach ( function ( file ) {
18+ sendFile ( file ) ;
19+ } ) ;
20+ } ) ;
21+
22+ fileInput . addEventListener ( 'change' , function ( evnt ) {
23+ fileList = [ ] ;
24+
25+ console . log ( "__FILELIST___" , fileInput . files ) ;
26+
27+ for ( var i = 0 ; i < fileInput . files . length ; i ++ ) {
28+ fileList . push ( fileInput . files [ i ] ) ;
29+ }
30+ renderFileList ( ) ;
31+ } ) ;
32+
33+ renderFileList = function ( ) {
34+ fileListDisplay . innerHTML = '' ;
35+ fileList . forEach ( function ( file , index ) {
36+ var fileDisplayEl = document . createElement ( 'p' ) ;
37+ fileDisplayEl . innerHTML = ( index + 1 ) + ': ' + file . name ;
38+ fileListDisplay . appendChild ( fileDisplayEl ) ;
39+
40+ const query = WOQL . and (
41+ WOQL . quad ( "v:Element" , "type" , "Class" , "schema" ) ,
42+ WOQL . opt ( ) . quad ( "v:Element" , "label" , "v:Label" , "schema" ) ,
43+ WOQL . opt ( ) . quad ( "v:Element" , "comment" , "v:Comment" , "schema" ) ,
44+ WOQL . opt ( ) . quad ( "v:Element" , "tcs:tag" , "v:Abstract" , "schema" )
45+ )
46+
47+ console . log ( formData ) ;
48+
49+ query . execute ( dbClient , formData ) ;
50+ } ) ;
51+
52+
53+
54+ } ;
55+
56+ sendFile = function ( file ) {
57+ var formData = new FormData ( ) ;
58+ formData . set ( 'file' , file ) ;
59+
60+ var request = new XMLHttpRequest ( ) ;
61+
62+ request . open ( "POST" , 'https://localhost' ) ;
63+ request . send ( formData ) ;
64+ } ;
65+ } ) ( ) ;
0 commit comments