Mercurial > hg > NetworkVis
annotate query_builder/querybuild.html @ 34:4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
| author | arussell |
|---|---|
| date | Sat, 19 Dec 2015 23:25:23 -0500 |
| parents | acc60a20582c |
| children |
| rev | line source |
|---|---|
| 28 | 1 <!DOCTYPE html> |
| 2 <html> | |
| 3 <head> | |
| 4 <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> | |
| 5 <title>Query Builder</title> | |
| 6 <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> | |
| 7 <link rel="stylesheet" href="select2-4.0.1/dist/css/select2.min.css"> | |
| 8 | |
| 9 <script type="text/javascript" src="js/d3.min.js"></script> | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
10 <script type="text/javascript" src="js/underscore-min.js"></script> |
| 28 | 11 <script type="text/javascript" src="select2-4.0.1/vendor/jquery-2.1.0.js"></script> |
| 12 <script type="text/javascript" src="select2-4.0.1/dist/js/select2.full.min.js"></script> | |
| 13 | |
| 14 | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
15 |
| 28 | 16 </head> |
| 17 <body style="background:none;"> | |
| 18 <div role="navigation" class="navbar navbar-default navbar-static-top"> | |
| 19 <div class="container"> | |
| 20 <div class="row"> | |
| 21 <div class="col-sm-6 col-md-6"> | |
| 22 <ul class="nav navbar-nav"> | |
| 23 </ul> | |
| 24 </div> | |
| 25 <div class="navbar-header col-sm-6 col-md-6" style="height: auto;"> | |
| 26 <div class="col-md-6"> | |
| 27 <div class="navbar-brand"> | |
| 28 <div class="brand">ISMI Query Builder</div> | |
| 29 </div> | |
| 30 </div> | |
| 31 <div class="col-md-offset-6"> | |
| 32 <div class="logo-well" style="height: 60%; width: 60%;"> | |
| 33 <a href="//neo4j.com/developer-resources"> | |
| 34 <img src="//neo4j-contrib.github.io/developer-resources/language-guides/assets/img/logo-white.svg" alt="Neo4j World's Leading Graph Database" id="logo" style="max-height: 50%; width: 50%"> | |
| 35 </a> | |
| 36 </div> | |
| 37 </div> | |
| 38 </div> | |
| 39 </div> | |
| 40 </div> | |
| 41 </div> | |
| 42 <div class="container"> | |
| 43 <div class="row" style="width: 95%"> | |
| 44 <div class="col-lg"> | |
| 45 <div class="panel panel-default"> | |
| 46 <div class="panel-heading" id="title">Query Builder</div> | |
| 47 | |
| 48 <section> | |
| 49 <div class="s2-example"> | |
| 50 <div id="filters"> | |
| 51 <div class="row" id="startrow" style="margin-top: 15px"> | |
| 52 <div class="col-sm-4 col-md-4" id="select-col1"> | |
| 53 <select class="selected-object form-control"> | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
54 <option selected>Object type : </option> |
| 28 | 55 </select> |
| 56 </div> | |
| 57 <div class="col-sm-4 col-md-4" id="select-col2"> | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
58 <select class="select-object1 form-control" id="startselect"> |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
59 <option disable selected></option> |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
60 <option>TEXT</option> |
| 28 | 61 <option>WITNESS</option> |
| 62 <option>PERSON</option> | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
63 <option>CODEX</option> |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
64 <option>PLACE</option> |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
65 <option>REPOSITORY</option> |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
66 <option>COLLECTION</option> |
| 28 | 67 </select> |
| 68 </div> | |
| 69 </div> | |
| 70 <div class="row" id="row1" style="margin-top: 15px"> | |
| 71 <div class="col-sm-4 col-md-4" id="1filter-col1"> | |
| 72 <select class="filter-box1 form-control"> | |
| 73 <option value="" disabled selected>Choose filter...</option> | |
| 74 </select> | |
| 75 </div> | |
| 76 </div> | |
| 77 </div> | |
| 78 <div align="left" style="margin-top: 30px"><button id="minus_filter_button" class="btn btn-warning btn-md" type="button"> - </button> | |
| 79 <button id="plus_filter_button" class="btn btn-warning btn-md" type="button"> + </button> | |
| 80 </div> | |
| 81 </div> | |
| 82 | |
| 83 | |
| 84 <div class="container-fluid" style="margin-top: 15px"> | |
| 85 <form role="form"> | |
| 86 <div class="form-group"> | |
| 87 <label for="results-container">Results list</label> | |
| 88 <select multiple class="form-control" id="results-container" style="min-height: 300px;"> | |
| 89 </select> | |
| 90 </div> | |
| 91 </form> | |
| 92 | |
| 93 </div> | |
| 94 | |
| 95 <!-- <pre data-fill-from=".js-code-data-array"></pre> --> | |
| 96 </section> | |
| 97 | |
| 98 </div> | |
| 99 </div> | |
| 100 </div> | |
| 101 </div> | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 <script type="text/javascript" class="js-code-data-array"> | |
| 109 //var queryData = []; | |
| 110 | |
| 111 // Defining initial variables and helper functions | |
| 112 var sourceType = "TEXT"; | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
113 var currentQueryData; |
| 28 | 114 var targets = []; |
| 115 var targetTypes = []; | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
116 var targetObj = [{}]; // The current objects on the display box |
| 28 | 117 var numFilters = 1; |
| 118 var filters = [ | |
| 119 { id: 0, text: 'has relation' }, | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
120 { id: 1, text: 'attribute' } |
| 28 | 121 ]; |
| 122 $(".filter-box"+numFilters).select2({ | |
| 123 // Initialize first filter box | |
| 124 data: filters, | |
| 125 minimumResultsForSearch: Infinity | |
| 126 }); | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
127 var listTolerance = 100; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
128 //$("") |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
129 |
| 28 | 130 function filter_html(n) { |
| 131 return '<div class="row" id="row'+n+'" style="margin-top: 15px">' + | |
| 132 '<div class="col-sm-4 col-md-4" id="'+n+'filter-col1">' + | |
| 133 '<select class="filter-box'+n+' form-control">' + | |
| 134 '<option value="" disabled selected>Choose filter...</option>' + | |
| 135 '</select>' + | |
| 136 '</div>' + | |
| 137 '</div>'; | |
| 138 } | |
| 139 function constraint_html(classn) { | |
| 140 return '<div class="col-sm-4 col-md-4" id="'+classn+'filter-col2">' + | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
141 '<select class="rel-constraint-box'+classn+' form-control" >' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
142 '</select>' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
143 '</div>'; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
144 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
145 function attr_constraint_html(classn) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
146 return '<div class="col-sm-4 col-md-4" id="'+classn+'filter-col2">' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
147 '<select class="attr-constraint-box'+classn+' form-control" >' + |
| 28 | 148 '</select>' + |
| 149 '</div>'; | |
| 150 } | |
| 151 function submit_html(classn) { | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
152 return '<div class="col-sm-4 col-md-4" id="'+classn+'filter-col3">' + |
| 28 | 153 '<div class="form-group'+classn+'">' + |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
154 '<form onsubmit="return false;"> ' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
155 '<input type="text" name="attr-field" class="form-control" id="attr-input'+classn+'">' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
156 '</input>' + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
157 '</form>' + |
| 28 | 158 '</div>' + |
| 159 '</div>'; | |
| 160 } | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
161 function select_html(selection, n) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
162 return '<div class="row" id="row'+n+'" style="margin-top: 15px">' + |
| 28 | 163 '<div class="col-sm-4 col-md-4" id="select-col1"> ' + |
| 164 '<select class="selected-object form-control"> ' + | |
| 165 '<option selected>Selected object is: </option> ' + | |
| 166 '</select> ' + | |
| 167 '</div> ' + | |
| 168 '<div class="col-sm-4 col-md-4" id="select-col2"> ' + | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
169 '<h4>' + selection + |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
170 '</h4>' + |
| 28 | 171 '</div> ' + |
| 172 '</div>'; | |
| 173 } | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 // Button filters | |
| 179 $("#plus_filter_button").click(function() { | |
| 180 console.log("add filter"); | |
| 181 numFilters++; | |
| 182 $("#filters").append(filter_html(numFilters)); | |
| 183 $(".filter-box"+numFilters).select2({ | |
| 184 data: filters, | |
| 185 minimumResultsForSearch: Infinity | |
| 186 }); | |
| 187 }); | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
188 // TODO: update minus button to alter the currRel currAttr arrays |
| 28 | 189 $("#minus_filter_button").click(function() { |
| 190 console.log("minus filter"); | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
191 //$("#row"+numFilters).remove(); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
192 //numFilters--; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
193 |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
194 // NOTE: Temporary solution for removing filters, |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
195 while (numFilters > 0) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
196 $("#row"+numFilters).remove(); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
197 numFilters--; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
198 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
199 numFilters++; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
200 $("#filters").append(filter_html(numFilters)); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
201 $(".filter-box"+numFilters).select2({ |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
202 data: filters, |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
203 minimumResultsForSearch: Infinity |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
204 }); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
205 currAttrs = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
206 currRels = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
207 currSource = sourceType; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
208 |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
209 |
| 28 | 210 }); |
| 211 $("#results-container").dblclick(function() { | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
212 var displayChoice = $("#results-container").find("option:selected").text(); |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
213 console.log(targetObj); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
214 if (!targetObj[displayChoice]) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
215 // increase tolerance |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
216 console.log("increase listTolerance"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
217 listTolerance = 100000; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
218 process_display_results(currentQueryData); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
219 listTolerance = 100; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
220 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
221 else { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
222 console.log(displayChoice + "........."); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
223 var displayType = targetObj[displayChoice]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
224 /* |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
225 _.map(targetObj, function(obj){ |
| 28 | 226 |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
227 if (_.values(_.values(targetObj))[1] === displayChoice) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
228 selection = (_.values(_.values(obj))[0])[1]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
229 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
230 else { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
231 selection = (_.values(_.values(obj))[0])[0]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
232 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
233 }); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
234 */ |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
235 numFilters++; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
236 $("#filters").append(select_html(displayChoice, numFilters)); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
237 // Generate inner relation list |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
238 //genRelations(sourceType, ".constraint-box"+numFilters); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
239 sourceType = displayChoice; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
240 console.log("New Target"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
241 genResults("New Target", [displayType,displayChoice], "target") |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
242 } |
| 28 | 243 }); |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
244 $(function() { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
245 $("input").submit(function(event, data) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
246 console.log($('.form-control').find("option:selected").text()); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
247 console.log(event); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
248 console.log(data); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
249 event.preventDefault(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
250 |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
251 }); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
252 }); |
| 28 | 253 |
| 254 | |
| 255 // Change Events | |
| 256 $('body').on('change', function(event){ | |
| 257 var classname = (event.target.className).substr(0, (event.target.className).indexOf(" ")); | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
258 var classnum = (event.target.className.match(/\d+\.\d+|\d+\b|\d+(?=\w)/g) || [] ).map(function (v) {return +v;}).shift(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
259 var allclass = '.'+classname; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
260 var selectedOption = $(allclass).find('option:selected').text(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
261 console.log("SEL "+ selectedOption); |
| 28 | 262 |
| 263 // Change is on the filter box | |
| 264 if (classname.indexOf("filter-box") > -1) { | |
| 265 if (selectedOption === "has relation") { | |
| 266 // Remove any other boxes in the row | |
| 267 $("#"+classnum+"filter-col2").remove(); | |
| 268 $("#row"+classnum).append(constraint_html(classnum)); | |
| 269 // Generate inner relation list | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
270 genRelations(sourceType, ".rel-constraint-box"+classnum); |
| 28 | 271 } |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
272 if (selectedOption === "attribute") { |
| 28 | 273 $("#"+classnum+"filter-col2").remove(); |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
274 $("#row"+classnum).append(attr_constraint_html(classnum)); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
275 genAttributes(sourceType, ".attr-constraint-box"+classnum); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
276 //$("#row"+classnum).append(submit_html(classnum)); |
| 28 | 277 $("#row"+classnum).append(submit_html(classnum)); |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
278 |
| 28 | 279 } |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
280 |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
281 // NOT IMPLEMENTED |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
282 /* |
| 28 | 283 if (selectedOption === "return") { |
| 284 $("#"+classnum+"filter-col2").remove(); | |
| 285 $("#row"+classnum).append(constraint_html(classnum)); | |
| 286 genAttributes(targetTypes, ".constraint-box"+classnum); | |
| 287 } | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
288 */ |
| 28 | 289 } |
| 290 | |
| 291 // Change is on the relationship constraint box | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
292 if (classname.indexOf("rel-constraint-box") > -1) { |
| 28 | 293 //$().remove(); |
| 294 genResults(sourceType, selectedOption, "results-container"); | |
| 295 } | |
| 296 | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
297 // Change is on the attr constraint box |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
298 if (classname.indexOf("attr-constraint-box") > -1) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
299 //$().remove(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
300 console.log("CHANGE ON ATTR"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
301 console.log("changing currentqueryattr to" + selectedOption); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
302 currentQueryAttr = selectedOption; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
303 console.log("currentQueryAttr is" + currentQueryAttr); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
304 //genResults(sourceType, selectedOption, "results-container"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
305 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
306 |
| 28 | 307 // Change is on subject scope |
| 308 if (classname.indexOf("select-object") > -1) { | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
309 sourceType = selectedOption; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
310 console.log("CHANGE ON SCOPE"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
311 genResults(sourceType, "New Source", "results-container"); |
| 28 | 312 |
| 313 //ajax1(query, "results-container") | |
| 314 } | |
| 315 }); | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
316 $("#filters").submit(function (event) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
317 var inputId = $("input:text[name=attr-field]")[0].id; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
318 var inputValue = $("input:text[name=attr-field]").val(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
319 // Alter results list |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
320 console.log("QUERY TYPE IS ATTRIBUTE NOW"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
321 currentQueryType = "attribute"; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
322 console.log("SUBMITTED"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
323 genResults(sourceType, inputValue, "results-container") |
| 28 | 324 |
| 325 | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
326 }); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
327 // For use in the onchange events above |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
328 function genRelations(sourceNodeType, constraintBox) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
329 console.log("GENERATE ALL RELATIONS"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
330 var query = "match (source:"+sourceNodeType+")-[rel]-target return distinct rel.type"; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
331 console.log("QUERY TYPE IS RELATION NOW"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
332 currentQueryType = "relation"; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
333 ajax1(query, constraintBox); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
334 } |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
335 |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
336 function genAttributes(sourceNodeType, constraintBox) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
337 console.log("GENERATE ALL ATTRIBUTES"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
338 var query = "match (n:"+sourceNodeType+") with keys(n) as collection unwind collection as attributes return distinct attributes"; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
339 ajax1(query, constraintBox); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
340 } |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
341 |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
342 function genResults(sourceNodeType, selected, constraintBox) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
343 // TODO: Return first the list of current values of the display box |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
344 |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
345 if (selected === "New Source") { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
346 console.log("NEW SOURCE - UPDATE RESULTS"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
347 var query = "match (source:"+sourceNodeType+") return source._n_label, source.type"; |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
348 set_current_query('source', sourceNodeType+")"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
349 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
350 else if (sourceNodeType === "New Target") { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
351 newTarget = 1; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
352 set_current_query('target', selected); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
353 var query = get_current_query; |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
354 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
355 else if (currentQueryType === "attribute") { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
356 console.log("ATTR CHANGE - UPDATE RESULTS"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
357 console.log("before update currentQueryAttr is " + currentQueryAttr); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
358 var qAttr = currentQueryAttr; |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
359 set_current_query('attribute', "."+qAttr+"=~\"(?i).*"+selected+".*\""); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
360 // this might cause an issue |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
361 var query = get_current_query(); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
362 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
363 /* |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
364 var query = "match (source:"+sourceNodeType+") where "; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
365 if (get_result_labels()) query += get_result_labels() + " AND "; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
366 query += "source."+qAttr+"=~\"(?i).*"+selected+".*\" return distinct source._n_label, source.type limit 5"; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
367 // TODO: case where all attributes are searched |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
368 // if (selected === "ALL") set_current_query('attribute', "."+qAttr+"=~\"(?i).*"+selected+".*\""); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
369 |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
370 console.log(query); |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
371 */ |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
372 else if (currentQueryType === "relation") { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
373 var query = "match (source:" + sourceNodeType + ")-[rel:" + selected + "]->(target) return distinct target._n_label, target.type"; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
374 console.log("REL CHANGE - UPDATE RESULTS"); |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
375 set_current_query('relation', selected+"]->("); |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
376 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
377 else { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
378 console.log("GENRESULTS IMPROPERLY CALLED"); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
379 return; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
380 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
381 ajax1(query, constraintBox); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
382 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
383 var currentQueryType; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
384 var currentQueryAttr; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
385 var resultLabelString = ""; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
386 function get_result_labels() { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
387 return resultLabelString; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
388 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
389 function set_result_labels(currentResults) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
390 resultLabelString = "("; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
391 for (var i = 0; i < currentResults.length; i++) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
392 if (i > 0) resultLabelString += " OR "; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
393 resultLabelString += 'source._n_label=\"'+currentResults[i].text.substr(1)+'\"'; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
394 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
395 resultLabelString += ")" |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
396 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
397 // to use contains |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
398 // TODO: start n = node(*) where n.Name =~ '.*SUBSTRING.*' return n.Name, n; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
399 |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
400 var currSource = [sourceType]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
401 var currRels = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
402 var currAttrs = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
403 var currQ = ''; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
404 |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
405 function set_current_query(type, q) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
406 if (type === 'source') { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
407 currSource[0] = ("match (source:"+q); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
408 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
409 else if (type === 'target') { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
410 currSource.push("match (target:"+q[0]+")"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
411 currRels = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
412 currAttrs = []; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
413 currAttrs.push("target._n_label=\""+q[1]+"\""); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
414 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
415 else if (type === 'relation') { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
416 currRels.push("-[rel"+currRels.length+":"+q+"target"+currRels.length+")"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
417 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
418 else if (type === 'attribute') { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
419 if (Boolean(currRels.length)) currAttrs.push("target"+(currRels.length-1)+q); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
420 else currAttrs.push("source"+q); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
421 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
422 else if (type === 'return') { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
423 return currQ |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
424 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
425 else { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
426 console.log("improper call to change current query"); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
427 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
428 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
429 var newTarget = -1; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
430 function get_current_query() { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
431 var currQ = currSource[currSource.length-1]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
432 var i; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
433 var n=currRels.length; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
434 var m=currAttrs.length; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
435 for (i=0; i<n; i++) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
436 currQ += currRels[i]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
437 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
438 currQ += " where "; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
439 for (i=0; i<m; i++) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
440 if (Boolean(i)) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
441 currQ += "AND "; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
442 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
443 currQ += currAttrs[i]+" "; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
444 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
445 if (Boolean(currRels.length)) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
446 currQ += "return distinct target"+(currRels.length-1)+"._n_label, target"+(currRels.length-1)+".type"; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
447 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
448 else if (newTarget > 0) { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
449 currQ += "return distinct target._n_label, target.type"; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
450 newTarget = -1; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
451 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
452 else currQ += "return distinct source._n_label, source.type"; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
453 console.log(currQ); |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
454 return currQ; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
455 } |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
456 |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
457 |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
458 |
| 28 | 459 |
| 460 | |
| 461 // Ajax request function | |
| 462 function ajax1(q, resBox) { | |
| 463 $.ajaxSetup({ | |
| 464 headers: { | |
| 465 "Authorization": 'Basic ' + window.btoa("neo4j"+":"+"neo5j") | |
| 466 } | |
| 467 }); | |
| 468 return $.ajax({ | |
| 469 type: "POST", | |
| 470 url: "https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data/cypher", | |
| 471 accepts: "application/json", | |
| 472 dataType: "json", | |
| 473 data: { | |
| 474 "query": q, | |
| 475 "params": {} | |
| 476 }, | |
| 477 beforeSend: function (xhr) { | |
| 478 xhr.setRequestHeader ("Authorization", "Basic " + btoa('neo4j'+":"+'neo5j')); | |
| 479 }, | |
| 480 processResults: function (data, params) { | |
| 481 // parse the results into the format expected by Select2 | |
| 482 // since we are using custom formatting functions we do not need to | |
| 483 // alter the remote JSON data, except to indicate that infinite | |
| 484 // scrolling can be used | |
| 485 params.page = params.page || 1; | |
| 486 return { | |
| 487 pagination: { | |
| 488 more: (params.page * 30) < data.length | |
| 489 } | |
| 490 }; | |
| 491 }, | |
| 492 success: function (res, textStatus, jqXHR) { | |
| 493 ajaxCheck(res, resBox, textStatus); | |
| 494 console.log(textStatus); | |
| 495 }, | |
| 496 error: function (jqXHR, textStatus, errorThrown) { | |
| 497 console.log(textStatus); | |
| 498 } | |
| 499 }); | |
| 500 } | |
| 501 // Check if request was successful | |
| 502 function ajaxCheck(a1, resBox, status){ | |
| 503 if (status === 'error') console.log("error: bad ajax request"); | |
| 504 //else dataGen(a1); | |
| 505 dataGen(a1.data, resBox); | |
| 506 } | |
| 507 // On success, generate new data | |
| 508 // TODO: might want to just always return nodes and then deal with the queryData different for each type of return | |
| 509 function dataGen(dataArr, resBox) { | |
| 510 var d = dataArr; | |
| 511 targets = []; | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
512 targetObj = []; |
| 28 | 513 |
| 514 // Consider implementing localStorage to avoid reloading every time | |
| 515 var queryData = []; | |
| 516 for (var i= 0; i<d.length; i++) { | |
| 517 var j = d[i]; | |
| 518 queryData.push({ id: j, text: j[0] }); | |
| 519 targets.push(j[1]); | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
520 targetObj[j[0]]=j[1]; |
| 28 | 521 } |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
522 console.log(queryData); |
| 28 | 523 // Now that queryData array has been defined we will sort it by its label value and initialize the option. |
| 524 queryData.sort(function(a,b){ | |
| 525 var c = a.text.replace(/<|>/g, ''); | |
| 526 var d = b.text.replace(/<|>/g, ''); | |
| 527 return c.localeCompare(d); | |
| 528 }); | |
| 529 | |
| 530 // Change the displayed results | |
| 531 if (resBox === "results-container") { | |
| 532 process_display_results(queryData); | |
| 533 } | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
534 if (resBox === "target") { |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
535 sourceType = currSource[0]; |
|
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
536 } |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
537 // Or fill any select boxes |
| 28 | 538 else { |
| 539 $(resBox).select2({ | |
| 540 data: queryData | |
| 541 }); | |
| 542 } | |
| 543 } | |
| 544 function process_display_results(queryData) { | |
|
34
4bbb832c53ac
Completed: Base functionality for simple examples. Minus button now removes all filters for simplicity. Still need to adjust how to go about restarting the querying process once a result has been selected from the display list (eg. the 'selected object is:' case). Also need to strip out a bunch of unneeded code.
arussell
parents:
32
diff
changeset
|
545 currentQueryData = queryData; |
| 28 | 546 var weights = []; |
| 547 var resultLength = queryData.length; | |
| 548 targetTypes = []; | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
549 set_result_labels(queryData); |
| 28 | 550 $('#results-container') |
| 551 .find('option') | |
| 552 .remove() | |
| 553 .end() | |
| 554 ; | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
555 for (var i = 0; i < targets.length; i++) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
556 if (targetTypes.indexOf(targets[i]) == -1) { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
557 targetTypes.push(targets[i]); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
558 weights.push(1); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
559 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
560 else { |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
561 weights[targetTypes.indexOf(targets[i])] += 1; |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
562 } |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
563 } |
| 28 | 564 if (resultLength < listTolerance) { |
| 565 for (var i = 0; i < resultLength; i++) { | |
| 566 // TODO: put this jQuery call into its own function to be called if the else statement occurs | |
| 567 // TODO: but the user actually does want to see the entire huge list. | |
|
32
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
568 // This next bit removes duplicate labels if we want to use that for things like cities |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
569 // would this throw issues with other things?? |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
570 //$('#results-container option:contains('+queryData[i].text+')').each(function(){ |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
571 // $(this).remove(); |
|
acc60a20582c
Temporary Changes for querybuilder. Selecting attribute and having results list filter not fully working yet. Need 'ALL' option in attributes.
arussell
parents:
28
diff
changeset
|
572 //}); |
| 28 | 573 $('#results-container') |
| 574 .append($("<option></option>") | |
| 575 .attr("value", i) | |
| 576 .text(queryData[i].text)); | |
| 577 } | |
| 578 } | |
| 579 else { | |
| 580 for (var i = 0; i < targetTypes.length; i++) { | |
| 581 $('#results-container') | |
| 582 .append($("<option></option>") | |
| 583 .text(targetTypes[i] + " [ " + weights[i] + " ]")); | |
| 584 } | |
| 585 } | |
| 586 } | |
| 587 | |
| 588 </script> | |
| 589 | |
| 590 </body> | |
| 591 </html> |
