solid-panes 3.5.28-alpha → 3.5.29-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +0 -2
  2. package/lib/RDFXMLPane.js +6 -8
  3. package/lib/RDFXMLPane.js.map +1 -1
  4. package/lib/argument/argumentPane.js +10 -11
  5. package/lib/argument/argumentPane.js.map +1 -1
  6. package/lib/attach/attachPane.js +47 -85
  7. package/lib/attach/attachPane.js.map +1 -1
  8. package/lib/audio/audioPane.js +11 -36
  9. package/lib/audio/audioPane.js.map +1 -1
  10. package/lib/classInstancePane.js +11 -20
  11. package/lib/classInstancePane.js.map +1 -1
  12. package/lib/dashboard/basicPreferences.js +3 -53
  13. package/lib/dashboard/basicPreferences.js.map +1 -1
  14. package/lib/dashboard/dashboardPane.js +2 -18
  15. package/lib/dashboard/dashboardPane.js.map +1 -1
  16. package/lib/dashboard/homepage.js +1 -19
  17. package/lib/dashboard/homepage.js.map +1 -1
  18. package/lib/dataContentPane.js +15 -58
  19. package/lib/dataContentPane.js.map +1 -1
  20. package/lib/defaultPane.js +13 -21
  21. package/lib/defaultPane.js.map +1 -1
  22. package/lib/dokieli/dokieliPane.js +19 -28
  23. package/lib/dokieli/dokieliPane.js.map +1 -1
  24. package/lib/dokieli/new.js.map +1 -1
  25. package/lib/form/pane.js +26 -40
  26. package/lib/form/pane.js.map +1 -1
  27. package/lib/home/homePane.js +7 -23
  28. package/lib/home/homePane.js.map +1 -1
  29. package/lib/humanReadablePane.js +14 -28
  30. package/lib/humanReadablePane.js.map +1 -1
  31. package/lib/imagePane.js +9 -13
  32. package/lib/imagePane.js.map +1 -1
  33. package/lib/index.js +4 -18
  34. package/lib/index.js.map +1 -1
  35. package/lib/internal/internalPane.js +10 -41
  36. package/lib/internal/internalPane.js.map +1 -1
  37. package/lib/mainPage/footer.js +0 -4
  38. package/lib/mainPage/footer.js.map +1 -1
  39. package/lib/mainPage/header.js +2 -28
  40. package/lib/mainPage/header.js.map +1 -1
  41. package/lib/mainPage/index.js +1 -12
  42. package/lib/mainPage/index.js.map +1 -1
  43. package/lib/microblogPane/microblogPane.js +100 -237
  44. package/lib/microblogPane/microblogPane.js.map +1 -1
  45. package/lib/n3Pane.js +2 -7
  46. package/lib/n3Pane.js.map +1 -1
  47. package/lib/outline/context.js +0 -2
  48. package/lib/outline/context.js.map +1 -1
  49. package/lib/outline/licenseOptions.js +9 -25
  50. package/lib/outline/licenseOptions.js.map +1 -1
  51. package/lib/outline/manager.js +178 -580
  52. package/lib/outline/manager.js.map +1 -1
  53. package/lib/outline/manager.test.js +1 -11
  54. package/lib/outline/manager.test.js.map +1 -1
  55. package/lib/outline/outlineIcons.js +30 -25
  56. package/lib/outline/outlineIcons.js.map +1 -1
  57. package/lib/outline/propertyViews.js +0 -10
  58. package/lib/outline/propertyViews.js.map +1 -1
  59. package/lib/outline/propertyViews.test.js +1 -3
  60. package/lib/outline/propertyViews.test.js.map +1 -1
  61. package/lib/outline/queryByExample.js +24 -76
  62. package/lib/outline/queryByExample.js.map +1 -1
  63. package/lib/outline/userInput.js +214 -454
  64. package/lib/outline/userInput.js.map +1 -1
  65. package/lib/outline/viewAsImage.js +0 -6
  66. package/lib/outline/viewAsImage.js.map +1 -1
  67. package/lib/outline/viewAsMbox.js +3 -4
  68. package/lib/outline/viewAsMbox.js.map +1 -1
  69. package/lib/pad/padPane.js +45 -93
  70. package/lib/pad/padPane.js.map +1 -1
  71. package/lib/playlist/playlistPane.js +3 -20
  72. package/lib/playlist/playlistPane.js.map +1 -1
  73. package/lib/profile/editProfile.view.js +7 -24
  74. package/lib/profile/editProfile.view.js.map +1 -1
  75. package/lib/profile/profile.dom.js +0 -3
  76. package/lib/profile/profile.dom.js.map +1 -1
  77. package/lib/registerPanes.js +29 -27
  78. package/lib/registerPanes.js.map +1 -1
  79. package/lib/schedule/formsForSchedule.js.map +1 -1
  80. package/lib/schedule/schedulePane.js +62 -122
  81. package/lib/schedule/schedulePane.js.map +1 -1
  82. package/lib/sharing/sharingPane.js +2 -10
  83. package/lib/sharing/sharingPane.js.map +1 -1
  84. package/lib/slideshow/slideshowPane.js +9 -14
  85. package/lib/slideshow/slideshowPane.js.map +1 -1
  86. package/lib/socialPane.js +43 -124
  87. package/lib/socialPane.js.map +1 -1
  88. package/lib/tabbed/tabbedPane.js +1 -15
  89. package/lib/tabbed/tabbedPane.js.map +1 -1
  90. package/lib/tableViewPane.js +4 -7
  91. package/lib/tableViewPane.js.map +1 -1
  92. package/lib/test-import-export/common.js +2 -1
  93. package/lib/test-import-export/common.js.map +1 -1
  94. package/lib/test-import-export/edit-importer.js +7 -9
  95. package/lib/test-import-export/edit-importer.js.map +1 -1
  96. package/lib/transaction/pane.js +31 -90
  97. package/lib/transaction/pane.js.map +1 -1
  98. package/lib/transaction/period.js +20 -71
  99. package/lib/transaction/period.js.map +1 -1
  100. package/lib/trip/tripPane.js +30 -34
  101. package/lib/trip/tripPane.js.map +1 -1
  102. package/lib/trustedApplications/trustedApplications.dom.js +8 -34
  103. package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
  104. package/lib/trustedApplications/trustedApplications.test.js +3 -8
  105. package/lib/trustedApplications/trustedApplications.test.js.map +1 -1
  106. package/lib/trustedApplications/trustedApplications.utils.js +0 -10
  107. package/lib/trustedApplications/trustedApplications.utils.js.map +1 -1
  108. package/lib/trustedApplications/trustedApplications.view.js +1 -22
  109. package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
  110. package/lib/ui/pane.js +22 -28
  111. package/lib/ui/pane.js.map +1 -1
  112. package/lib/versionInfo.d.ts +2 -0
  113. package/lib/versionInfo.d.ts.map +1 -1
  114. package/lib/versionInfo.js +18 -16
  115. package/lib/versionInfo.js.map +1 -1
  116. package/lib/video/videoPane.js +2 -5
  117. package/lib/video/videoPane.js.map +1 -1
  118. package/package.json +24 -24
  119. package/src/versionInfo.ts +18 -16
@@ -1,28 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  var UI = _interopRequireWildcard(require("solid-ui"));
4
-
5
4
  var _solidLogic = require("solid-logic");
6
-
7
5
  var panes = _interopRequireWildcard(require("pane-registry"));
8
-
9
6
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
-
11
7
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
-
13
8
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
14
-
15
9
  var $rdf = UI.rdf;
16
10
  var UserInputFormula; // Formula to store references of user's work
17
-
18
11
  var TempFormula; // Formula to store incomplete triples (Requests),
19
12
  // temporarily disjoint with kb to avoid bugs
20
13
 
21
14
  module.exports = function UserInput(outline) {
22
15
  var myDocument = outline.document; // is this ok?
23
16
  // UI.log.warn("myDocument when it's set is "+myDocument.location);
24
-
25
17
  this.menuId = 'predicateMenu1';
18
+
26
19
  /* //namespace information, as a subgraph of the knowledge base, is built in showMenu
27
20
  this.namespaces={};
28
21
  for (var name in UI.ns) {
@@ -30,39 +23,41 @@ module.exports = function UserInput(outline) {
30
23
  }
31
24
  var NameSpaces=this.namespaces;
32
25
  */
33
- // hq, print and trim functions
34
26
 
27
+ // hq, print and trim functions
35
28
  var qp = function qp(str) {
36
29
  console.log(str + '\n');
37
- }; // var tabont = UI.ns.tabont;
38
- // var foaf = UI.ns.foaf
39
-
30
+ };
40
31
 
41
- var rdf = UI.ns.rdf; // var RDFS = UI.ns.rdfs
32
+ // var tabont = UI.ns.tabont;
33
+ // var foaf = UI.ns.foaf
34
+ var rdf = UI.ns.rdf;
35
+ // var RDFS = UI.ns.rdfs
42
36
  // var OWL = UI.ns.owl
43
37
  // var dc = UI.ns.dc
44
38
  // var rss = UI.ns.rss
45
39
  // var contact = UI.ns.contact
46
40
  // var mo = UI.ns.mo
47
-
48
41
  var bibo = UI.rdf.Namespace('http://purl.org/ontology/bibo/'); // hql for pubsPane
49
42
  // var dcterms = UI.rdf.Namespace('http://purl.org/dc/terms/')
50
-
51
43
  var dcelems = UI.rdf.Namespace('http://purl.org/dc/elements/1.1/');
52
44
  var movedArrow = false; // hq
45
+
53
46
  // var updateService=new updateCenter(kb);
54
47
 
55
48
  if (!UserInputFormula) {
56
49
  UserInputFormula = new UI.rdf.Formula();
57
- UserInputFormula.superFormula = _solidLogic.store; // UserInputFormula.registerFormula("Your Work");
50
+ UserInputFormula.superFormula = _solidLogic.store;
51
+ // UserInputFormula.registerFormula("Your Work");
58
52
  }
59
53
 
60
- if (!TempFormula) TempFormula = new UI.rdf.IndexedFormula(); // Use RDFIndexedFormula so add returns the statement
61
-
54
+ if (!TempFormula) TempFormula = new UI.rdf.IndexedFormula();
55
+ // Use RDFIndexedFormula so add returns the statement
62
56
  TempFormula.name = 'TempFormula';
63
57
  if (!_solidLogic.store.updater) _solidLogic.store.updater = new UI.rdf.UpdateManager(_solidLogic.store);
64
58
  return {
65
59
  // updateService: updateService,
60
+
66
61
  sparqler: _solidLogic.store.updater,
67
62
  lastModified: null,
68
63
  // the last <input> being modified, .isNew indicates whether it's a new input
@@ -75,36 +70,37 @@ module.exports = function UserInput(outline) {
75
70
  * Triggering Events: event entry points, should be called only from outline.js but not anywhere else
76
71
  * in userinput.js, should be as short as possible, function names to be discussed
77
72
  */
73
+
78
74
  // Called when the blue cross under the default pane is clicked.
79
75
  // Add a new row to a property list ( P and O)
80
76
  addNewPredicateObject: function addNewPredicateObject(e) {
81
77
  if (UI.utils.getTarget(e).className !== 'bottom-border-active') return;
82
78
  var This = outline.UserInput;
83
- var target = UI.utils.getTarget(e); // UI.log.warn(ancestor(target,'TABLE').textContent);
79
+ var target = UI.utils.getTarget(e);
84
80
 
81
+ // UI.log.warn(ancestor(target,'TABLE').textContent);
85
82
  var insertTr = myDocument.createElement('tr');
86
83
  UI.utils.ancestor(target, 'DIV').insertBefore(insertTr, UI.utils.ancestor(target, 'TR'));
87
84
  var tempTr = myDocument.createElement('tr');
88
85
  var reqTerm1 = This.generateRequest('(TBD)', tempTr, true);
89
86
  insertTr.appendChild(tempTr.firstChild);
90
87
  var reqTerm2 = This.generateRequest('(Enter text or drag an object onto this field)', tempTr, false);
91
- insertTr.appendChild(tempTr.firstChild); // there should be an elegant way of doing this
92
- // Take the why of the last TR and write to it.
88
+ insertTr.appendChild(tempTr.firstChild);
89
+ // there should be an elegant way of doing this
93
90
 
94
- if (UI.utils.ancestor(target, 'TR').previousSibling && // there is a previous predicate/object line
91
+ // Take the why of the last TR and write to it.
92
+ if (UI.utils.ancestor(target, 'TR').previousSibling &&
93
+ // there is a previous predicate/object line
95
94
  UI.utils.ancestor(target, 'TR').previousSibling.AJAR_statement) {
96
- var preStat = UI.utils.ancestor(target, 'TR').previousSibling.AJAR_statement; // This should always(?) input a non-inverse statement
97
-
95
+ var preStat = UI.utils.ancestor(target, 'TR').previousSibling.AJAR_statement;
96
+ // This should always(?) input a non-inverse statement
98
97
  This.formUndetStat(insertTr, preStat.subject, reqTerm1, reqTerm2, preStat.why, false);
99
98
  } else {
100
99
  // no previous row: write to the document defining the subject
101
100
  var subject = UI.utils.getAbout(_solidLogic.store, UI.utils.ancestor(target.parentNode.parentNode, 'TD'));
102
-
103
101
  var doc = _solidLogic.store.sym(UI.rdf.Util.uri.docpart(subject.uri));
104
-
105
102
  This.formUndetStat(insertTr, subject, reqTerm1, reqTerm2, doc, false);
106
103
  }
107
-
108
104
  outline.walk('moveTo', insertTr.firstChild);
109
105
  UI.log.info('addNewPredicateObject: selection = ' + outline.getSelection().map(function (item) {
110
106
  return item.textContent;
@@ -116,25 +112,25 @@ module.exports = function UserInput(outline) {
116
112
  // tr.AJAR_statement (an incomplete statement in TempFormula) stores the destination(why), now
117
113
  // determined by the preceding one (is this good?)
118
114
  addNewObject: function addNewObject(e) {
119
- var predicateTd = UI.utils.getTarget(e).parentNode.parentNode; // var predicateTerm = UI.utils.getAbout(kb, predicateTd)
120
-
121
- var isInverse = predicateTd.parentNode.AJAR_inverse; // var titleTerm=UI.utils.getAbout(kb,UI.utils.ancestor(predicateTd.parentNode,'TD'));
115
+ var predicateTd = UI.utils.getTarget(e).parentNode.parentNode;
116
+ // var predicateTerm = UI.utils.getAbout(kb, predicateTd)
117
+ var isInverse = predicateTd.parentNode.AJAR_inverse;
118
+ // var titleTerm=UI.utils.getAbout(kb,UI.utils.ancestor(predicateTd.parentNode,'TD'));
122
119
  // set pseudo lastModifiedStat here
123
-
124
120
  this.lastModifiedStat = predicateTd.parentNode.AJAR_statement;
125
121
  var insertTr = this.appendToPredicate(predicateTd);
126
122
  var reqTerm = this.generateRequest(' (Error) ', insertTr, false);
127
123
  var preStat = insertTr.previousSibling.AJAR_statement;
128
-
129
124
  if (!isInverse) {
130
125
  this.formUndetStat(insertTr, preStat.subject, preStat.predicate, reqTerm, preStat.why, false);
131
126
  } else {
132
127
  this.formUndetStat(insertTr, reqTerm, preStat.predicate, preStat.object, preStat.why, true);
133
128
  }
134
-
135
129
  outline.walk('moveTo', insertTr.lastChild);
136
- this.startFillInText(insertTr.lastChild); // this.statIsInverse=false;
130
+ this.startFillInText(insertTr.lastChild);
131
+ // this.statIsInverse=false;
137
132
  },
133
+
138
134
  // Called when delete is pressed
139
135
  Delete: function Delete(selectedTd) {
140
136
  this.deleteTriple(selectedTd, false);
@@ -147,8 +143,8 @@ module.exports = function UserInput(outline) {
147
143
  Click: function Click(e) {
148
144
  var target = UI.utils.getTarget(e);
149
145
  if (UI.utils.getTerm(target).termType !== 'Literal') return;
150
- this.literalModification(target); // this prevents the generated inputbox to be clicked again
151
-
146
+ this.literalModification(target);
147
+ // this prevents the generated inputbox to be clicked again
152
148
  e.preventDefault();
153
149
  e.stopPropagation();
154
150
  },
@@ -156,31 +152,25 @@ module.exports = function UserInput(outline) {
156
152
  pasteFromClipboard: function pasteFromClipboard(address, selectedTd) {
157
153
  function termFrom(fromCode) {
158
154
  var term = outline.clipboard[fromCode].shift();
159
-
160
155
  if (term === null) {
161
156
  UI.log.warn('no more element in clipboard!');
162
157
  return;
163
158
  }
164
-
165
159
  switch (fromCode) {
166
160
  case 'predicates':
167
161
  case 'objects':
168
162
  {
169
163
  var allArray = outline.clipboard.all;
170
-
171
164
  for (var i = 0; true; i++) {
172
165
  if (term.sameTerm(allArray[i])) {
173
166
  allArray.splice(i, 1);
174
167
  break;
175
168
  }
176
169
  }
177
-
178
170
  break;
179
171
  }
180
-
181
172
  case 'all':
182
173
  throw new Error('hostorical code not understood - what is theCollection?');
183
-
184
174
  /*
185
175
  var isObject = term.sameTerm(theCollection('objects').elements[0])
186
176
  isObject ? outline.clipboard.objecs.shift() : outline.clipboard.predicates.shift() // drop the corresponding term
@@ -191,21 +181,17 @@ module.exports = function UserInput(outline) {
191
181
 
192
182
  return term;
193
183
  }
194
-
195
184
  var term;
196
-
197
185
  switch (selectedTd.className) {
198
186
  case 'undetermined selected':
199
187
  term = selectedTd.nextSibling ? termFrom('predicates') : termFrom('objects');
200
188
  if (!term) return;
201
189
  break;
202
-
203
190
  case 'pred selected':
204
191
  // paste objects into this predicate
205
192
  term = termFrom('objects');
206
193
  if (!term) return;
207
194
  break;
208
-
209
195
  case 'selected':
210
196
  {
211
197
  // header <TD>, undetermined generated
@@ -216,13 +202,12 @@ module.exports = function UserInput(outline) {
216
202
  return;
217
203
  }
218
204
  }
219
-
220
205
  this.insertTermTo(selectedTd, term);
221
206
  },
222
-
223
207
  /**
224
208
  * Intermediate Processing:
225
209
  */
210
+
226
211
  // a general entry point for any event except Click&Enter(goes to literalModification)
227
212
  // do a little inference to pick the right input box
228
213
  startFillInText: function startFillInText(selectedTd) {
@@ -235,14 +220,12 @@ module.exports = function UserInput(outline) {
235
220
  this.lastModified.isNew = false;
236
221
  this.lastModified.select();
237
222
  break;
238
-
239
223
  case 'predicate':
240
224
  // the goal is to bring back all the menus (with autocomplete functionality
241
225
  // this.performAutoCompleteEdit(selectedTd,['PredicateAutoComplete',
242
226
  // this.choiceQuery('SuggestPredicateByDomain')]);
243
227
  this.performAutoCompleteEdit(selectedTd, 'PredicateAutoComplete');
244
228
  break;
245
-
246
229
  case 'ObjectProperty-like':
247
230
  case 'no-idea':
248
231
  // menu should be either function that
@@ -260,21 +243,19 @@ module.exports = function UserInput(outline) {
260
243
  */
261
244
  }
262
245
  },
263
- literalModification: function literalModification(selectedTd) {
264
- UI.log.debug('entering literal Modification with ' + selectedTd + selectedTd.textContent); // var This=outline.UserInput;
265
246
 
247
+ literalModification: function literalModification(selectedTd) {
248
+ UI.log.debug('entering literal Modification with ' + selectedTd + selectedTd.textContent);
249
+ // var This=outline.UserInput;
266
250
  if (selectedTd.className.indexOf(' pendingedit') !== -1) {
267
251
  UI.log.warn('The node you attempted to edit has a request still pending.\n' + 'Please wait for the request to finish (the text will turn black)\n' + 'before editing this node again.');
268
252
  return true;
269
253
  }
270
-
271
254
  var target = selectedTd;
272
255
  var about = this.getStatementAbout(target); // timbl - to avoid alert from random clicks
273
-
274
256
  if (!about) return;
275
257
  var obj;
276
258
  var trNode;
277
-
278
259
  try {
279
260
  obj = UI.utils.getTerm(target);
280
261
  trNode = UI.utils.ancestor(target, 'TR');
@@ -282,15 +263,13 @@ module.exports = function UserInput(outline) {
282
263
  UI.log.warn('userinput.js: ' + e + UI.utils.getAbout(_solidLogic.store, selectedTd));
283
264
  UI.log.error(target + ' getStatement Error:' + e);
284
265
  }
285
-
286
266
  var tdNode;
287
-
288
267
  try {
289
268
  tdNode = trNode.lastChild;
290
269
  } catch (e) {
291
270
  UI.log.error(e + '@' + target);
292
- } // seems to be a event handling problem of firefox3
293
-
271
+ }
272
+ // seems to be a event handling problem of firefox3
294
273
  /*
295
274
  if (e.type!='keypress'&&(selectedTd.className=='undetermined selected'||selectedTd.className=='undetermined')){
296
275
  this.Refill(e,selectedTd);
@@ -300,7 +279,6 @@ module.exports = function UserInput(outline) {
300
279
  // ignore clicking trNode.firstChild (be careful for <div> or <span>)
301
280
  // if (e.type!='keypress'&&target!=tdNode && UI.utils.ancestor(target,'TD')!=tdNode) return;
302
281
 
303
-
304
282
  if (obj.termType === 'Literal') {
305
283
  tdNode.removeChild(tdNode.firstChild); // remove the text
306
284
 
@@ -308,21 +286,20 @@ module.exports = function UserInput(outline) {
308
286
  // match a line feed and require <TEXTAREA>
309
287
  var textBox = myDocument.createElement('textarea');
310
288
  textBox.appendChild(myDocument.createTextNode(obj.value));
311
- textBox.setAttribute('rows', (obj.value.match(/\n/g).length + 1).toString()); // g is for global(??)
312
-
289
+ textBox.setAttribute('rows', (obj.value.match(/\n/g).length + 1).toString());
290
+ // g is for global(??)
313
291
  textBox.setAttribute('cols', '100'); // should be the size of <TD>
314
-
315
292
  textBox.setAttribute('class', 'textinput');
316
293
  tdNode.appendChild(textBox);
317
294
  this.lastModified = textBox;
318
295
  } else {
319
296
  this.lastModified = this.createInputBoxIn(tdNode, obj.value);
320
297
  }
321
-
322
- this.lastModified.isNew = false; // Kenny: What should be expected after you click a editable text element?
298
+ this.lastModified.isNew = false;
299
+ // Kenny: What should be expected after you click a editable text element?
323
300
  // Choice 1
324
-
325
- this.lastModified.select(); // Choice 2 - direct the key cursor to where you click (failed attempt)
301
+ this.lastModified.select();
302
+ // Choice 2 - direct the key cursor to where you click (failed attempt)
326
303
  // --------------------------------------------------------------------------
327
304
  // duplicate the event so user can edit without clicking twice
328
305
  // var e2=myDocument.createEvent("MouseEvents");
@@ -350,7 +327,6 @@ module.exports = function UserInput(outline) {
350
327
  // this pops up the autocomplete menu
351
328
  // Pops up the menu even though no keypress has occurred
352
329
  // 1 is a dummy variable for the "enterEvent"
353
-
354
330
  this.getAutoCompleteHandler(menu)(1);
355
331
  },
356
332
  backOut: function backOut() {
@@ -359,9 +335,9 @@ module.exports = function UserInput(outline) {
359
335
  },
360
336
  clearMenu: function clearMenu() {
361
337
  var menu = myDocument.getElementById(this.menuID);
362
-
363
338
  if (menu) {
364
- menu.parentNode.removeChild(menu); // emptyNode(menu);
339
+ menu.parentNode.removeChild(menu);
340
+ // emptyNode(menu);
365
341
  }
366
342
  },
367
343
 
@@ -369,7 +345,6 @@ module.exports = function UserInput(outline) {
369
345
  clearInputAndSave: function clearInputAndSave(e) {
370
346
  var obj;
371
347
  if (!this.lastModified) return;
372
-
373
348
  if (!this.lastModified.isNew) {
374
349
  try {
375
350
  obj = this.getStatementAbout(this.lastModified).object;
@@ -377,33 +352,29 @@ module.exports = function UserInput(outline) {
377
352
  return;
378
353
  }
379
354
  }
380
-
381
355
  var s = this.lastModifiedStat; // when 'isNew' this is set at addNewObject()
382
356
 
383
357
  var defaultpropview;
384
358
  var trNode;
385
359
  var reqTerm;
386
360
  var preStat;
387
-
388
361
  if (this.lastModified.value !== this.lastModified.defaultValue) {
389
362
  var trCache;
390
-
391
363
  if (this.lastModified.value === '') {
392
364
  // ToDo: remove this
393
365
  this.lastModified.value = this.lastModified.defaultValue;
394
366
  this.clearInputAndSave();
395
367
  return;
396
368
  } else if (this.lastModified.isNew) {
397
- s = new UI.rdf.Statement(s.subject, s.predicate, _solidLogic.store.literal(this.lastModified.value), s.why); // TODO: DEFINE ERROR CALLBACK
398
-
369
+ s = new UI.rdf.Statement(s.subject, s.predicate, _solidLogic.store.literal(this.lastModified.value), s.why);
370
+ // TODO: DEFINE ERROR CALLBACK
399
371
  defaultpropview = this.views.defaults[s.predicate.uri];
400
372
  trCache = UI.utils.ancestor(this.lastModified, 'TR');
401
-
402
373
  try {
403
374
  _solidLogic.store.updater.update([], [s], function (uri, success, errorBody) {
404
375
  if (!success) {
405
- UI.log.error('Error occurs while inserting ' + s + '\n\n' + errorBody + '\n'); // UI.log.warn("Error occurs while inserting "+s+'\n\n'+errorBody);
406
-
376
+ UI.log.error('Error occurs while inserting ' + s + '\n\n' + errorBody + '\n');
377
+ // UI.log.warn("Error occurs while inserting "+s+'\n\n'+errorBody);
407
378
  outline.UserInput.deleteTriple(trCache.lastChild, true);
408
379
  }
409
380
  });
@@ -411,7 +382,6 @@ module.exports = function UserInput(outline) {
411
382
  UI.log.error('Error inserting fact ' + s + ':\n\t' + e + '\n');
412
383
  return;
413
384
  }
414
-
415
385
  s = _solidLogic.store.add(s.subject, s.predicate, _solidLogic.store.literal(this.lastModified.value), s.why);
416
386
  } else {
417
387
  if (this.statIsInverse) {
@@ -419,19 +389,17 @@ module.exports = function UserInput(outline) {
419
389
  this.backOut();
420
390
  return;
421
391
  }
422
-
423
392
  var s1, s2, s3;
424
-
425
393
  switch (obj.termType) {
426
394
  case 'Literal':
427
395
  {
428
396
  // generate path and nailing from current values
397
+
429
398
  // TODO: DEFINE ERROR CALLBACK
430
399
  var valueCache = this.lastModified.value;
431
400
  trCache = UI.utils.ancestor(this.lastModified, 'TR');
432
401
  var oldValue = this.lastModified.defaultValue;
433
402
  s2 = $rdf.st(s.subject, s.predicate, _solidLogic.store.literal(this.lastModified.value), s.why);
434
-
435
403
  try {
436
404
  _solidLogic.store.updater.update([s], [s2], function (uri, success, errorBody) {
437
405
  if (success) {
@@ -440,30 +408,25 @@ module.exports = function UserInput(outline) {
440
408
  UI.log.warn('Error occurs while editing ' + s + '\n\n' + errorBody);
441
409
  trCache.lastChild.textContent = oldValue;
442
410
  }
443
-
444
411
  trCache.lastChild.className = trCache.lastChild.className.replace(/ pendingedit/g, '');
445
412
  });
446
413
  } catch (e) {
447
414
  UI.log.warn('Error occurs while editing ' + s + ':\n\t' + e);
448
415
  return;
449
- } // obj.value=this.lastModified.value;
416
+ }
417
+ // obj.value=this.lastModified.value;
450
418
  // UserInputFormula.statements.push(s);
451
-
452
-
453
419
  break;
454
420
  }
455
-
456
421
  case 'BlankNode':
457
422
  {
458
423
  // a request refill with text
459
424
  // var newStat
460
- var textTerm = _solidLogic.store.literal(this.lastModified.value, ''); // <Feature about="labelChoice">
461
-
462
-
425
+ var textTerm = _solidLogic.store.literal(this.lastModified.value, '');
426
+ // <Feature about="labelChoice">
463
427
  if (s.predicate.termType === 'Collection') {
464
428
  // case: add triple ????????? Weird - tbl
465
429
  var selectedPredicate = s.predicate.elements[0]; // @@ TBL elements is a list on the predicate??
466
-
467
430
  if (_solidLogic.store.any(undefined, selectedPredicate, textTerm)) {
468
431
  if (!e) {
469
432
  // keyboard
@@ -472,7 +435,6 @@ module.exports = function UserInput(outline) {
472
435
  e.pageX = UI.utils.findPos(tdNode)[0];
473
436
  e.pageY = UI.utils.findPos(tdNode)[1] + tdNode.clientHeight;
474
437
  }
475
-
476
438
  this.showMenu(e, 'DidYouMeanDialog', undefined, {
477
439
  dialogTerm: _solidLogic.store.any(undefined, selectedPredicate, textTerm),
478
440
  bnodeTerm: s.subject
@@ -480,14 +442,11 @@ module.exports = function UserInput(outline) {
480
442
  } else {
481
443
  s1 = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR').parentNode, 'TR').AJAR_statement;
482
444
  s2 = $rdf.st(s.subject, selectedPredicate, textTerm, s.why);
483
-
484
445
  var type = _solidLogic.store.the(s.subject, rdf('type'));
485
-
486
- s3 = _solidLogic.store.anyStatementMatching(s.subject, rdf('type'), type, s.why); // TODO: DEFINE ERROR CALLBACK
446
+ s3 = _solidLogic.store.anyStatementMatching(s.subject, rdf('type'), type, s.why);
447
+ // TODO: DEFINE ERROR CALLBACK
487
448
  // because the table is repainted, so...
488
-
489
449
  trCache = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR'), 'TD').parentNode;
490
-
491
450
  try {
492
451
  _solidLogic.store.updater.update([], [s1, s2, s3], function (uri, success, errorBody) {
493
452
  if (!success) {
@@ -499,23 +458,20 @@ module.exports = function UserInput(outline) {
499
458
  console.log('Error occurs while editing ' + s1 + ':\n\t' + e);
500
459
  return;
501
460
  }
502
-
503
461
  _solidLogic.store.remove(s);
504
-
505
462
  _solidLogic.store.add(s.subject, selectedPredicate, textTerm, s.why); // was: newStat =
506
463
  // a subtle bug occurs here, if foaf:nick hasn't been dereferneced,
507
464
  // this add will cause a repainting
508
-
509
465
  }
510
466
 
511
467
  var enclosingTd = UI.utils.ancestor(this.lastModified.parentNode.parentNode, 'TD');
512
468
  var defaultPane = panes.byName('default'); // @@ check
513
-
514
469
  outline.outlineExpand(enclosingTd, s.subject, {
515
470
  pane: defaultPane,
516
471
  already: true
517
472
  });
518
- outline.walk('right', outline.focusTd); // </Feature>
473
+ outline.walk('right', outline.focusTd);
474
+ // </Feature>
519
475
  } else {
520
476
  this.fillInRequest('object', this.lastModified.parentNode, _solidLogic.store.literal(this.lastModified.value));
521
477
  return; // The new Td is already generated by fillInRequest, so it's done.
@@ -530,15 +486,14 @@ module.exports = function UserInput(outline) {
530
486
  trNode = UI.utils.ancestor(this.lastModified, 'TR');
531
487
  reqTerm = this.generateRequest('(To be determined. Re-type of drag an object onto this field)');
532
488
  preStat = trNode.previousSibling.AJAR_statement; // the statement of the same predicate
489
+ this.formUndetStat(trNode, preStat.subject, preStat.predicate, reqTerm, preStat.why, false);
490
+ // this why being the same as the previous statement
491
+ this.lastModified = null;
533
492
 
534
- this.formUndetStat(trNode, preStat.subject, preStat.predicate, reqTerm, preStat.why, false); // this why being the same as the previous statement
535
-
536
- this.lastModified = null; // UI.log.warn("test .isNew)");
537
-
493
+ // UI.log.warn("test .isNew)");
538
494
  return;
539
495
  } else if (s.predicate.termType === 'Collection') {
540
496
  _solidLogic.store.removeMany(s.subject);
541
-
542
497
  var upperTr = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR').parentNode, 'TR');
543
498
  preStat = upperTr.AJAR_statement;
544
499
  reqTerm = this.generateRequest('(To be determined. Re-type of drag an object onto this field)');
@@ -562,10 +517,10 @@ module.exports = function UserInput(outline) {
562
517
  this.backOut();
563
518
  return;
564
519
  }
565
- } // case modified - literal modification only(for now).
566
-
567
-
568
- trNode = UI.utils.ancestor(this.lastModified, 'TR'); // var defaultpropview = this.views.defaults[s.predicate.uri]
520
+ }
521
+ // case modified - literal modification only(for now).
522
+ trNode = UI.utils.ancestor(this.lastModified, 'TR');
523
+ // var defaultpropview = this.views.defaults[s.predicate.uri]
569
524
 
570
525
  if (!this.statIsInverse) {
571
526
  // this is for an old feature
@@ -574,35 +529,31 @@ module.exports = function UserInput(outline) {
574
529
  } else {
575
530
  outline.replaceTD(outline.outlineObjectTD(s.subject, defaultpropview), trNode.lastChild);
576
531
  }
577
-
578
532
  if (this.lastModified.value !== this.lastModified.defaultValue) {
579
533
  trNode.lastChild.className += ' pendingedit';
580
- } // trNode.AJAR_statement=s;//you don't have to set AJAR_inverse because it's not changed
534
+ }
535
+ // trNode.AJAR_statement=s;//you don't have to set AJAR_inverse because it's not changed
581
536
  // This is going to be painful when predicate-edit allowed
582
-
583
-
584
537
  this.lastModified = null;
585
538
  },
586
-
587
539
  /* deletes the triple corresponding to selectedTd, remove that Td. */
588
540
  deleteTriple: function deleteTriple(selectedTd, isBackOut) {
589
541
  // ToDo: complete deletion of a node
590
- UI.log.debug('deleteTriple entered'); // allow a pending node to be deleted if it's a backout sent by SPARQL update callback
542
+ UI.log.debug('deleteTriple entered');
591
543
 
544
+ // allow a pending node to be deleted if it's a backout sent by SPARQL update callback
592
545
  if (!isBackOut && selectedTd.className.indexOf(' pendingedit') !== -1) {
593
546
  console.log('The node you attempted to edit has a request still pending.\n' + 'Please wait for the request to finish (the text will turn black)\n' + 'before editing this node again.');
594
547
  outline.walk('up');
595
548
  return;
596
549
  }
597
-
598
- var removedTr; // var afterTr
599
-
550
+ var removedTr;
551
+ // var afterTr
600
552
  var s = this.getStatementAbout(selectedTd);
601
-
602
- if (!isBackOut && !_solidLogic.store.whether(s.object, rdf('type'), UI.ns.link('Request')) && // Better to check whether provenance is internal?
553
+ if (!isBackOut && !_solidLogic.store.whether(s.object, rdf('type'), UI.ns.link('Request')) &&
554
+ // Better to check whether provenance is internal?
603
555
  !_solidLogic.store.whether(s.predicate, rdf('type'), UI.ns.link('Request')) && !_solidLogic.store.whether(s.subject, rdf('type'), UI.ns.link('Request'))) {
604
556
  UI.log.debug('about to send SPARQLUpdate');
605
-
606
557
  try {
607
558
  _solidLogic.store.updater.update([s], [], function (uri, success, errorBody) {
608
559
  if (success) {
@@ -613,43 +564,36 @@ module.exports = function UserInput(outline) {
613
564
  selectedTd.className = selectedTd.className.replace(/ pendingedit/g, '');
614
565
  }
615
566
  });
616
-
617
567
  selectedTd.className += ' pendingedit';
618
568
  } catch (e) {
619
569
  UI.log.error(e);
620
570
  UI.log.warn('Error deleting statement ' + s + ':\n\t' + e);
621
571
  return;
622
572
  }
623
-
624
573
  UI.log.debug('SPARQLUpdate sent');
625
- } else {// removal of an undetermined statement associated with pending TRs
574
+ } else {
575
+ // removal of an undetermined statement associated with pending TRs
626
576
  // TempFormula.remove(s);
627
577
  }
628
-
629
578
  UI.log.debug('about to remove ' + s);
630
579
  UI.log.debug('removed');
631
- outline.walk('up'); // eslint-disable-next-line prefer-const
632
-
633
- removedTr = selectedTd.parentNode; // afterTr = removedTr.nextSibling
634
-
580
+ outline.walk('up');
581
+ // eslint-disable-next-line prefer-const
582
+ removedTr = selectedTd.parentNode;
583
+ // afterTr = removedTr.nextSibling
635
584
  function removefromview() {
636
585
  var trIterator;
637
-
638
586
  for (trIterator = removedTr; trIterator.childNodes.length === 1; trIterator = trIterator.previousSibling) {
639
587
  ;
640
588
  }
641
-
642
589
  var predicateTd;
643
-
644
590
  if (trIterator === removedTr) {
645
591
  var theNext = trIterator.nextSibling;
646
-
647
592
  if (theNext.nextSibling && theNext.childNodes.length === 1) {
648
593
  predicateTd = trIterator.firstChild;
649
594
  predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1);
650
595
  theNext.insertBefore(trIterator.firstChild, theNext.firstChild);
651
596
  }
652
-
653
597
  removedTr.parentNode.removeChild(removedTr);
654
598
  } else {
655
599
  // !DisplayOptions["display:block on"].enabled){
@@ -658,10 +602,8 @@ module.exports = function UserInput(outline) {
658
602
  removedTr.parentNode.removeChild(removedTr);
659
603
  }
660
604
  }
661
-
662
605
  if (isBackOut) removefromview();
663
606
  },
664
-
665
607
  /* clipboard principle: copy wildly, paste carefully
666
608
  ToDoS:
667
609
  1. register Subcollection?
@@ -690,49 +632,42 @@ module.exports = function UserInput(outline) {
690
632
  trans.setTransferData("text/x-mox-url", str, copytext.length * 2);
691
633
  clip.setData(trans, null, clipid.kGlobalClipboard);
692
634
  */
693
- var term = UI.utils.getTerm(selectedTd);
694
635
 
636
+ var term = UI.utils.getTerm(selectedTd);
695
637
  switch (selectedTd.className) {
696
638
  case 'selected': // table header
697
-
698
639
  case 'obj selected':
699
640
  // var objects = outline.clipboard.objects
700
641
  outline.clipboard.objects.unshift(term);
701
642
  break;
702
-
703
643
  case 'pred selected':
704
644
  case 'pred internal selected':
705
645
  outline.clipboard.predicates.unshift(term);
706
646
  }
707
-
708
647
  outline.clipboard.all.unshift(term);
709
648
  },
710
649
  insertTermTo: function insertTermTo(selectedTd, term, isObject) {
711
650
  var defaultpropview;
712
651
  var preStat;
713
-
714
652
  switch (selectedTd.className) {
715
653
  case 'undetermined selected':
716
654
  defaultpropview = this.views.defaults[selectedTd.parentNode.AJAR_statement.predicate.uri];
717
655
  this.fillInRequest(selectedTd.nextSibling ? 'predicate' : 'object', selectedTd, term);
718
656
  break;
719
-
720
657
  case 'pred selected':
721
658
  {
722
659
  // paste objects into this predicate
723
660
  var insertTr = this.appendToPredicate(selectedTd);
724
661
  preStat = selectedTd.parentNode.AJAR_statement;
725
662
  defaultpropview = this.views.defaults[preStat.predicate.uri];
726
- insertTr.appendChild(outline.outlineObjectTD(term, defaultpropview)); // modify store and update here
727
-
663
+ insertTr.appendChild(outline.outlineObjectTD(term, defaultpropview));
664
+ // modify store and update here
728
665
  var isInverse = selectedTd.parentNode.AJAR_inverse;
729
-
730
666
  if (!isInverse) {
731
667
  insertTr.AJAR_statement = _solidLogic.store.add(preStat.subject, preStat.predicate, term, preStat.why);
732
668
  } else {
733
669
  insertTr.AJAR_statemnet = _solidLogic.store.add(term, preStat.predicate, preStat.object, preStat.why);
734
670
  }
735
-
736
671
  try {
737
672
  _solidLogic.store.updater.update([], [insertTr.AJAR_statement], function (uri, success, errorBody) {
738
673
  if (!success) {
@@ -743,25 +678,22 @@ module.exports = function UserInput(outline) {
743
678
  UI.log.error('Exception trying to insert statement ' + insertTr.AJAR_statement + ': ' + UI.utils.stackString(e));
744
679
  return;
745
680
  }
746
-
747
681
  insertTr.AJAR_inverse = isInverse;
748
682
  UserInputFormula.statements.push(insertTr.AJAR_statement);
749
683
  break;
750
684
  }
751
-
752
685
  case 'selected':
753
686
  {
754
687
  // header <TD>, undetermined generated
755
688
  var paneDiv = UI.utils.ancestor(selectedTd, 'TABLE').lastChild;
756
- var newTr = paneDiv.insertBefore(myDocument.createElement('tr'), paneDiv.lastChild); // var titleTerm=UI.utils.getAbout(kb,UI.utils.ancestor(newTr,'TD'));
757
-
689
+ var newTr = paneDiv.insertBefore(myDocument.createElement('tr'), paneDiv.lastChild);
690
+ // var titleTerm=UI.utils.getAbout(kb,UI.utils.ancestor(newTr,'TD'));
758
691
  preStat = newTr.previousSibling.AJAR_statement;
759
692
  if (typeof isObject === 'undefined') isObject = true;
760
-
761
693
  if (isObject) {
762
694
  // object inserted
763
- this.formUndetStat(newTr, preStat.subject, this.generateRequest('(TBD)', newTr, true), term, preStat.why, false); // defaultpropview temporaily not dealt with
764
-
695
+ this.formUndetStat(newTr, preStat.subject, this.generateRequest('(TBD)', newTr, true), term, preStat.why, false);
696
+ // defaultpropview temporaily not dealt with
765
697
  newTr.appendChild(outline.outlineObjectTD(term));
766
698
  outline.walk('moveTo', newTr.firstChild);
767
699
  this.startFillInText(newTr.firstChild);
@@ -774,7 +706,6 @@ module.exports = function UserInput(outline) {
774
706
  outline.walk('moveTo', newTr.lastChild);
775
707
  this.startFillInText(newTr.lastChild);
776
708
  }
777
-
778
709
  break;
779
710
  }
780
711
  }
@@ -783,13 +714,11 @@ module.exports = function UserInput(outline) {
783
714
  UI.log.info('Refill' + selectedTd.textContent);
784
715
  var isPredicate = selectedTd.nextSibling;
785
716
  var predicateQuery;
786
-
787
717
  if (isPredicate) {
788
718
  // predicateTd
789
719
  var subject;
790
720
  var subjectClass;
791
721
  var sparqlText;
792
-
793
722
  if (selectedTd.nextSibling.className === 'undetermined') {
794
723
  /* Make set of proprties to propose for a predicate.
795
724
  The naive approach is to take those which have a class
@@ -803,7 +732,6 @@ module.exports = function UserInput(outline) {
803
732
  ?pred rdfs:domain subjectClass.
804
733
  }
805
734
  */
806
-
807
735
  /* SELECT ?pred ?class
808
736
  WHERE{
809
737
  ?pred a rdf:Property.
@@ -811,7 +739,6 @@ module.exports = function UserInput(outline) {
811
739
  ?pred rdfs:domain ?class.
812
740
  }
813
741
  */
814
-
815
742
  /* SELECT ?pred
816
743
  WHERE{
817
744
  subject a ?subjectClass.
@@ -823,13 +750,11 @@ module.exports = function UserInput(outline) {
823
750
  sparqlText = [];
824
751
  var endl = '.\n';
825
752
  sparqlText[0] = 'SELECT ?pred WHERE{\n?pred ' + rdf('type') + rdf('Property') + '.\n' + '?pred ' + UI.ns.rdfs('domain') + subjectClass + '.}'; // \n is required? SPARQL parser bug?
826
-
827
753
  sparqlText[1] = 'SELECT ?pred ?class\nWHERE{\n' + '?pred ' + rdf('type') + rdf('Property') + '.\n' + subjectClass + UI.ns.rdfs('subClassOf') + ' ?class.\n' + '?pred ' + UI.ns.rdfs('domain') + ' ?class.\n}';
828
754
  sparqlText[2] = 'SELECT ?pred WHERE{\n' + subject + rdf('type') + _solidLogic.store.variable('subjectClass') + endl + _solidLogic.store.variable('pred') + UI.ns.rdfs('domain') + _solidLogic.store.variable('subjectClass') + endl + '}';
829
755
  predicateQuery = sparqlText.map($rdf.SPARQLToQuery);
830
756
  } else {
831
757
  // ------selector
832
-
833
758
  /* SELECT ?pred
834
759
  WHERE{
835
760
  ?pred a rdf:Property.
@@ -838,7 +763,6 @@ module.exports = function UserInput(outline) {
838
763
  }
839
764
  */
840
765
  // Candidate
841
-
842
766
  /* SELECT ?pred
843
767
  WHERE{
844
768
  subject a ?subjectClass.
@@ -848,18 +772,17 @@ module.exports = function UserInput(outline) {
848
772
  */
849
773
  subject = UI.utils.getAbout(_solidLogic.store, UI.utils.ancestor(selectedTd, 'TABLE').parentNode);
850
774
  subjectClass = _solidLogic.store.any(subject, rdf('type'));
851
- var object = selectedTd.parentNode.AJAR_statement.object; // var objectClass = (object.termType === 'Literal') ? UI.ns.rdfs('Literal') : kb.any(object, rdf('type'))
775
+ var object = selectedTd.parentNode.AJAR_statement.object;
776
+ // var objectClass = (object.termType === 'Literal') ? UI.ns.rdfs('Literal') : kb.any(object, rdf('type'))
852
777
  // var sparqlText="SELECT ?pred WHERE{\n?pred "+rdf('type')+rdf('Property')+".\n"+
853
778
  // "?pred "+UI.ns.rdfs('domain')+subjectClass+".\n"+
854
779
  // "?pred "+UI.ns.rdfs('range')+objectClass+".\n}"; // \n is required? SPARQL parser bug?
855
-
856
780
  sparqlText = 'SELECT ?pred WHERE{' + subject + rdf('type') + '?subjectClass' + '.\n' + object + rdf('type') + '?objectClass' + '.\n' + '?pred ' + UI.ns.rdfs('domain') + '?subjectClass' + '.\n' + '?pred ' + UI.ns.rdfs('range') + '?objectClass' + '.\n}'; // \n is required? SPARQL parser bug?
857
-
858
781
  predicateQuery = $rdf.SPARQLToQuery(sparqlText);
859
- } // -------presenter
860
- // ToDo: how to sort selected predicates?
861
-
782
+ }
862
783
 
784
+ // -------presenter
785
+ // ToDo: how to sort selected predicates?
863
786
  this.showMenu(e, 'GeneralPredicateChoice', predicateQuery, {
864
787
  isPredicate: isPredicate,
865
788
  selectedTd: selectedTd
@@ -867,20 +790,18 @@ module.exports = function UserInput(outline) {
867
790
  } else {
868
791
  // objectTd
869
792
  var predicateTerm = selectedTd.parentNode.AJAR_statement.predicate;
870
-
871
793
  if (_solidLogic.store.whether(predicateTerm, rdf('type'), UI.ns.owl('DatatypeProperty')) || predicateTerm.termType === 'Collection' || _solidLogic.store.whether(predicateTerm, UI.ns.rdfs('range'), UI.ns.rdfs('Literal'))) {
872
794
  selectedTd.className = '';
873
795
  UI.utils.emptyNode(selectedTd);
874
796
  this.lastModified = this.createInputBoxIn(selectedTd, ' (Please Input) ');
875
797
  this.lastModified.isNew = false;
876
798
  this.lastModified.select();
877
- } // show menu for rdf:type
878
-
799
+ }
879
800
 
801
+ // show menu for rdf:type
880
802
  if (selectedTd.parentNode.AJAR_statement.predicate.sameTerm(rdf('type'))) {
881
- var _sparqlText = 'SELECT ?class WHERE{?class ' + rdf('type') + UI.ns.rdfs('Class') + '.}'; // I should just use kb.each
882
-
883
-
803
+ var _sparqlText = 'SELECT ?class WHERE{?class ' + rdf('type') + UI.ns.rdfs('Class') + '.}';
804
+ // I should just use kb.each
884
805
  var classQuery = $rdf.SPARQLToQuery(_sparqlText);
885
806
  this.showMenu(e, 'TypeChoice', classQuery, {
886
807
  isPredicate: isPredicate,
@@ -892,32 +813,27 @@ module.exports = function UserInput(outline) {
892
813
  // This is where pubsPane.js comes in, with: outline.UserInput.getAutoCompleteHandler("JournalTAC")(e);
893
814
  getAutoCompleteHandler: function getAutoCompleteHandler(mode) {
894
815
  qp('\n\n***** In getAutoCompleteHandler ****** mode = ' + mode);
895
-
896
816
  if (mode === 'PredicateAutoComplete') {
897
817
  mode = 'predicate';
898
818
  } else if (mode !== 'JournalTAC') {
899
819
  // hq // why? -tim - not 'predicate' below
900
820
  mode = 'all';
901
821
  }
902
-
903
822
  var InputBox;
904
-
905
823
  if (mode === 'JournalTAC') {
906
824
  // hq // Better to pass in InputBox as a param
907
825
  InputBox = myDocument.getElementById('inpid_journal_title');
908
826
  } else {
909
827
  InputBox = this.lastModified || outline.getSelection()[0].firstChild;
910
828
  }
911
-
912
829
  qp('InputBox=' + InputBox); // hq
913
-
914
830
  qp('InputBox.value=' + InputBox.value); // hq
915
831
 
916
832
  return function (enterEvent) {
917
- qp('ENTER EVENT=' + enterEvent); // Firefox 2.0.0.6 makes this not working? 'this' becomes [object HTMLInputElement]
833
+ qp('ENTER EVENT=' + enterEvent);
834
+ // Firefox 2.0.0.6 makes this not working? 'this' becomes [object HTMLInputElement]
918
835
  // but not [wrapped ...]
919
836
  // var InputBox=(typeof enterEvent=='object')?this:this.lastModified;//'this' is the <input> element
920
-
921
837
  qp('1. outside (if eneterEvent)');
922
838
  var e = {};
923
839
  var tdNode = InputBox.parentNode;
@@ -926,60 +842,48 @@ module.exports = function UserInput(outline) {
926
842
  e.pageY = UI.utils.findPos(tdNode)[1] + tdNode.clientHeight;
927
843
  qp('epX=' + e.pageX + ', epY=' + e.pageY + ', mode=' + mode);
928
844
  var menu = myDocument.getElementById(outline.UserInput.menuID);
929
-
930
845
  function setHighlightItem(item) {
931
846
  if (!item) return; // do not make changes
932
-
933
847
  if (menu.lastHighlight) menu.lastHighlight.className = '';
934
848
  menu.lastHighlight = item;
935
849
  menu.lastHighlight.className = 'activeItem';
936
850
  outline.showURI(UI.utils.getAbout(_solidLogic.store, menu.lastHighlight));
937
851
  }
938
-
939
852
  if (enterEvent) {
940
853
  // either the real event of the pseudo number passed by OutlineKeypressPanel
941
854
  qp('2. in (if enterEvent). with type = ' + _typeof(enterEvent));
942
855
  var newText = InputBox.value;
943
-
944
856
  if (_typeof(enterEvent) === 'object') {
945
857
  qp('3. in typeof enterEvent is object, will switch to keys, arrows, etc. keycode = ' + enterEvent.keyCode);
946
858
  enterEvent.stopPropagation();
947
-
948
859
  if (menu && !menu.lastHighlight) {
949
860
  // this ensures the following operation valid
950
861
  setHighlightItem(menu.firstChild.firstChild);
951
862
  }
952
-
953
863
  switch (enterEvent.keyCode) {
954
864
  case 13: // enter
955
-
956
865
  case 9:
957
866
  // tab
958
867
  qp('handler: Enter or Tab');
959
-
960
868
  if (!menu) {
961
869
  outline.UserInput.clearInputAndSave();
962
870
  return;
963
871
  }
964
-
965
872
  if (!menu.lastHighlight) {
966
873
  if (mode === 'JournalTAC') {
967
874
  outline.UserInput.clearMenu();
968
875
  qp('no lastH');
969
876
  return 'no lastH';
970
877
  }
971
-
972
878
  return;
973
879
  } // warning?
974
880
 
975
-
976
881
  if (menu.lastHighlight.tagName === 'INPUT') {
977
882
  switch (menu.lastHighlight.value) {
978
883
  case 'New...':
979
884
  qp('subcase New');
980
885
  outline.UserInput.createNew();
981
886
  break;
982
-
983
887
  case 'GiveURI':
984
888
  qp('subcase GiveURI');
985
889
  outline.UserInput.inputURI();
@@ -988,65 +892,55 @@ module.exports = function UserInput(outline) {
988
892
  } else {
989
893
  // pubsPane Stuff:
990
894
  if (mode === 'JournalTAC') {
991
- qp('movedArrow? ' + movedArrow); // Enter only works if arrows have been moved
992
-
895
+ qp('movedArrow? ' + movedArrow);
896
+ // Enter only works if arrows have been moved
993
897
  if (movedArrow && menu.lastHighlight) {
994
898
  // Get the title from the DOM
995
899
  // tr, th, div, innerHTML
996
- var jtitle = menu.lastHighlight.firstChild.firstChild.innerHTML; // tr, th, td, innerHTML
997
-
998
- var juri = menu.lastHighlight.firstChild.nextSibling.innerHTML; // clearing out the &lt; and &gt; from juri
999
-
900
+ var jtitle = menu.lastHighlight.firstChild.firstChild.innerHTML;
901
+ // tr, th, td, innerHTML
902
+ var juri = menu.lastHighlight.firstChild.nextSibling.innerHTML;
903
+ // clearing out the &lt; and &gt; from juri
1000
904
  juri = juri.slice(4, -4);
1001
905
  return ['gotdptitle', jtitle, juri];
1002
- } // If doesn't qualify to be autocomplete, return this random string, since pubsPane checks for "gotdptitle"
1003
-
1004
-
906
+ }
907
+ // If doesn't qualify to be autocomplete, return this random string, since pubsPane checks for "gotdptitle"
1005
908
  return 'asGivenTxt';
1006
909
  }
1007
-
1008
910
  var inputTerm = UI.utils.getAbout(_solidLogic.store, menu.lastHighlight);
1009
911
  var fillInType = mode === 'predicate' ? 'predicate' : 'object';
1010
912
  outline.UserInput.clearMenu();
1011
- outline.UserInput.fillInRequest(fillInType, InputBox.parentNode, inputTerm); // if (outline.UserInput.fillInRequest(fillInType,InputBox.parentNode,inputTerm))
913
+ outline.UserInput.fillInRequest(fillInType, InputBox.parentNode, inputTerm);
914
+ // if (outline.UserInput.fillInRequest(fillInType,InputBox.parentNode,inputTerm))
1012
915
  // outline.UserInput.clearMenu();
1013
916
  }
1014
917
 
1015
918
  qp('outside');
1016
919
  return;
1017
-
1018
920
  case 38:
1019
921
  // up
1020
922
  qp('handler: Arrow UP');
1021
923
  movedArrow = true; // hq
1022
-
1023
924
  if (newText === '' && menu.lastHighlight.tagName === 'TR' && !menu.lastHighlight.previousSibling) {
1024
925
  setHighlightItem(menu.firstChild.firstChild);
1025
926
  } else {
1026
927
  setHighlightItem(menu.lastHighlight.previousSibling);
1027
928
  }
1028
-
1029
929
  return "I'm a little Arrow Up";
1030
-
1031
930
  case 40:
1032
931
  // down
1033
932
  qp('handler: Arrow Down');
1034
933
  movedArrow = true; // hq
1035
-
1036
934
  if (menu.lastHighlight.tagName === 'INPUT') {
1037
935
  setHighlightItem(menu.childNodes[1].firstChild);
1038
936
  } else {
1039
937
  setHighlightItem(menu.lastHighlight.nextSibling);
1040
938
  }
1041
-
1042
939
  return "I'm a little Down Arrow";
1043
-
1044
940
  case 37: // left
1045
-
1046
941
  case 39:
1047
942
  // right
1048
943
  qp('handler: Arrow left, right');
1049
-
1050
944
  if (menu.lastHighlight.tagName === 'INPUT') {
1051
945
  if (enterEvent.keyCode === 37) {
1052
946
  setHighlightItem(menu.lastHighlight.previousSibling);
@@ -1054,35 +948,28 @@ module.exports = function UserInput(outline) {
1054
948
  setHighlightItem(menu.lastHighlight.nextSibling);
1055
949
  }
1056
950
  }
1057
-
1058
951
  return;
1059
-
1060
952
  case 8:
1061
953
  // backspace
1062
954
  qp('handler: Backspace');
1063
955
  newText = newText.slice(0, -1);
1064
956
  break;
1065
-
1066
957
  case 27:
1067
958
  // esc to enter literal
1068
959
  qp('handler: Esc');
1069
-
1070
960
  if (!menu) {
1071
961
  outline.UserInput.backOut();
1072
962
  return;
1073
963
  }
1074
-
1075
- outline.UserInput.clearMenu(); // Not working? I don't know.
964
+ outline.UserInput.clearMenu();
965
+ // Not working? I don't know.
1076
966
  // InputBox.removeEventListener('keypress',outline.UserInput.Autocomplete,false);
1077
-
1078
967
  return;
1079
968
  // break
1080
-
1081
969
  default:
1082
970
  qp('handler: Default');
1083
971
  movedArrow = false; // hq
1084
972
  // we need this because it is keypress, seeAlso performAutoCompleteEdit
1085
-
1086
973
  qp('oldtext=' + newText);
1087
974
  newText += String.fromCharCode(enterEvent.charCode);
1088
975
  qp('charcodent=' + enterEvent.charCode);
@@ -1091,14 +978,13 @@ module.exports = function UserInput(outline) {
1091
978
  // hq
1092
979
  }
1093
980
  } // endif typeof(event) === object
981
+
1094
982
  // UI.log.warn(InputBox.choices.length);
1095
983
  // for(i=0;InputBox.choices[i].label<newText;i++); //O(n) ToDo: O(log n)
1096
-
1097
-
1098
984
  if (mode === 'all') {
1099
985
  qp('generalAC after switch, newText=' + newText + 'mode is all');
1100
- outline.UserInput.clearMenu(); // outline.UserInput.showMenu(e,'GeneralAutoComplete',undefined,{'isPredicate':false,'selectedTd':tdNode,'choices':InputBox.choices, 'index':i});
1101
-
986
+ outline.UserInput.clearMenu();
987
+ // outline.UserInput.showMenu(e,'GeneralAutoComplete',undefined,{'isPredicate':false,'selectedTd':tdNode,'choices':InputBox.choices, 'index':i});
1102
988
  outline.UserInput.showMenu(e, 'GeneralAutoComplete', undefined, {
1103
989
  inputText: newText,
1104
990
  selectedTd: tdNode
@@ -1115,20 +1001,17 @@ module.exports = function UserInput(outline) {
1115
1001
  } else if (mode === 'JournalTAC') {
1116
1002
  // hq
1117
1003
  qp('JouralTAC after switch, newText=' + newText);
1118
- outline.UserInput.clearMenu(); // Goto showMenu
1119
-
1004
+ outline.UserInput.clearMenu();
1005
+ // Goto showMenu
1120
1006
  outline.UserInput.showMenu(e, 'JournalTitleAutoComplete', undefined, {
1121
1007
  inputText: newText
1122
1008
  }, 'orderisuseless');
1123
1009
  }
1124
-
1125
1010
  menu = myDocument.getElementById(outline.UserInput.menuID);
1126
-
1127
1011
  if (!menu) {
1128
1012
  qp('No menu element. Do not show menu.');
1129
1013
  return;
1130
1014
  }
1131
-
1132
1015
  qp('at end of handler\n^^^^^^^^^^^^^^^^^\n\n');
1133
1016
  setHighlightItem(menu.firstChild.firstChild);
1134
1017
  outline.showURI(UI.utils.getAbout(_solidLogic.store, menu.lastHighlight));
@@ -1136,6 +1019,7 @@ module.exports = function UserInput(outline) {
1136
1019
  }
1137
1020
  }; // end of return function
1138
1021
  },
1022
+
1139
1023
  // Add the buttons which allow the suer to craete a new object
1140
1024
  // Or reference an exiting one with a URI.
1141
1025
  //
@@ -1148,17 +1032,14 @@ module.exports = function UserInput(outline) {
1148
1032
  input1.value = 'New...';
1149
1033
  input2.type = 'button';
1150
1034
  input2.value = 'Know its URI';
1151
-
1152
1035
  function highlightInput(e) {
1153
1036
  // same as the one in newMenu()
1154
1037
  var menu = myDocument.getElementById(outline.UserInput.menuID);
1155
1038
  if (menu.lastHighlight) menu.lastHighlight.className = '';
1156
1039
  menu.lastHighlight = UI.utils.ancestor(UI.utils.getTarget(e), 'INPUT');
1157
1040
  if (!menu.lastHighlight) return; // mouseover <TABLE>
1158
-
1159
1041
  menu.lastHighlight.className = 'activeItem';
1160
1042
  }
1161
-
1162
1043
  div.addEventListener('mouseover', highlightInput, false);
1163
1044
  input1.addEventListener('click', this.createNew, false);
1164
1045
  input2.addEventListener('click', this.inputURI, false);
@@ -1174,29 +1055,27 @@ module.exports = function UserInput(outline) {
1174
1055
  this.lastModified.setAttribute('rows', (preRows + 1).toString());
1175
1056
  e.stopPropagation();
1176
1057
  }
1177
- } // Remark by Kenny: If the user wants to input more lines into an one-line-only blank.
1058
+ }
1059
+ // Remark by Kenny: If the user wants to input more lines into an one-line-only blank.
1178
1060
  // Direct him/her to a new blank (how?)
1179
-
1180
1061
  },
1062
+
1181
1063
  Mousedown: function Mousedown(e) {
1182
- qp('MOUSING DOWN'); // temporary key ctrl+s or q for swiching mode
1064
+ qp('MOUSING DOWN');
1065
+ // temporary key ctrl+s or q for swiching mode
1183
1066
  // This was in HCIOptions "right click to switch mode":
1184
-
1185
1067
  window.addEventListener('keypress', function (e) {
1186
1068
  if (e.ctrlKey && (e.charCode === 115 || e.charCode === 113)) {
1187
1069
  UserInput.switchMode();
1188
1070
  }
1189
1071
  }, false);
1190
1072
  window.addEventListener('mousedown', UserInput.Mousedown, false);
1191
-
1192
1073
  document.getElementById('outline').oncontextmenu = function () {
1193
1074
  return false;
1194
1075
  };
1195
-
1196
1076
  if (e.button === 2) {
1197
1077
  // right click
1198
1078
  UserInput.switchMode();
1199
-
1200
1079
  if (e) {
1201
1080
  e.preventDefault();
1202
1081
  e.stopPropagation();
@@ -1205,7 +1084,6 @@ module.exports = function UserInput(outline) {
1205
1084
  },
1206
1085
  Mouseover: function Mouseover(e) {
1207
1086
  this.className = 'bottom-border-active';
1208
-
1209
1087
  if (this._tabulatorMode === 1) {
1210
1088
  switch (UI.utils.getTarget(e).tagName) {
1211
1089
  case 'TD':
@@ -1215,43 +1093,37 @@ module.exports = function UserInput(outline) {
1215
1093
  break;
1216
1094
  }
1217
1095
  // Uh...I think I might have to give up this
1218
-
1219
1096
  case 'DIV':
1220
1097
  {
1221
1098
  var border = UI.utils.getTarget(e);
1222
-
1223
1099
  if (UI.utils.getTarget(e).className === 'bottom-border') {
1224
1100
  border.style.borderColor = 'rgb(100%,65%,0%)';
1225
1101
  border.style.cursor = 'copy';
1226
1102
  }
1227
-
1228
1103
  break;
1229
1104
  }
1230
-
1231
1105
  default:
1232
1106
  }
1233
1107
  }
1234
1108
  },
1235
1109
  Mouseout: function Mouseout(e) {
1236
1110
  this.className = 'bottom-border';
1237
-
1238
1111
  if (this._tabulatorMode === 1) {
1239
1112
  var border = UI.utils.getTarget(e);
1240
-
1241
1113
  if (UI.utils.getTarget(e).className === 'bottom-border') {
1242
1114
  border.style.borderColor = 'transparent';
1243
1115
  border.style.cursor = 'auto';
1244
1116
  }
1245
1117
  }
1246
1118
  },
1247
-
1248
1119
  /**
1249
1120
  * Utilities
1250
1121
  */
1122
+
1251
1123
  whatSortOfEditCell: function whatSortOfEditCell(selectedTd) {
1252
1124
  if (selectedTd.nextSibling) return 'predicate';
1253
- var predicateTerm = this.getStatementAbout(selectedTd).predicate; // var predicateTerm=selectedTd.parentNode.AJAR_statement.predicate;
1254
-
1125
+ var predicateTerm = this.getStatementAbout(selectedTd).predicate;
1126
+ // var predicateTerm=selectedTd.parentNode.AJAR_statement.predicate;
1255
1127
  if (_solidLogic.store.whether(predicateTerm, UI.ns.rdf('type'), UI.ns.owl('DatatypeProperty')) || _solidLogic.store.whether(predicateTerm, UI.ns.rdfs('range'), UI.ns.rdfs('Literal')) || predicateTerm.termType === 'Collection') {
1256
1128
  return 'DatatypeProperty-like';
1257
1129
  } else if (_solidLogic.store.whether(predicateTerm, rdf('type'), UI.ns.owl('ObjectProperty'))) {
@@ -1263,21 +1135,17 @@ module.exports = function UserInput(outline) {
1263
1135
  getStatementAbout: function getStatementAbout(something) {
1264
1136
  // var trNode=something.parentNode;
1265
1137
  var trNode = UI.utils.ancestor(something, 'TR');
1266
-
1267
1138
  if (!trNode) {
1268
1139
  throw new Error('No ancestor TR for the TD we clicked on:' + something);
1269
1140
  }
1270
-
1271
1141
  var statement;
1272
-
1273
1142
  try {
1274
1143
  statement = trNode.AJAR_statement;
1275
1144
  } catch (e) {
1276
1145
  throw new Error('No AJAR_statement!' + something + something.textContent + ' has ancestor ' + trNode); // was commented out @@
1277
1146
  // throw 'TR not a statement TR' // was commented out @@
1278
- } // Set last modified here, I am not sure this will be ok.
1279
-
1280
-
1147
+ }
1148
+ // Set last modified here, I am not sure this will be ok.
1281
1149
  this.lastModifiedStat = trNode.AJAR_statement;
1282
1150
  this.statIsInverse = trNode.AJAR_inverse;
1283
1151
  return statement;
@@ -1289,19 +1157,16 @@ module.exports = function UserInput(outline) {
1289
1157
  outline.UserInput.clearInputAndSave();
1290
1158
  }
1291
1159
  }
1292
-
1293
1160
  UI.log.info('myDocument in createInputBoxIn is now ' + myDocument.location);
1294
1161
  UI.log.info('outline.document is now ' + outline.document.location);
1295
1162
  var inputBox = myDocument.createElement('input');
1296
1163
  inputBox.setAttribute('value', defaultText);
1297
- inputBox.setAttribute('class', 'textinput'); // inputBox.setAttribute('size','100');//should be the size of <TD>
1298
-
1164
+ inputBox.setAttribute('class', 'textinput');
1165
+ // inputBox.setAttribute('size','100');//should be the size of <TD>
1299
1166
  if (tdNode.className !== 'undetermined selected') {
1300
1167
  inputBox.setAttribute('size', '100'); // should be the size of <TD>
1301
-
1302
1168
  inputBox.addEventListener('keypress', UpAndDown, false);
1303
1169
  }
1304
-
1305
1170
  tdNode.appendChild(inputBox);
1306
1171
  return inputBox;
1307
1172
  },
@@ -1310,11 +1175,9 @@ module.exports = function UserInput(outline) {
1310
1175
  outline.UserInput.clearMenu();
1311
1176
  var selectedTd = outline.getSelection()[0];
1312
1177
  var targetdoc = selectedTd.parentNode.AJAR_statement.why;
1313
-
1314
1178
  var newTerm = _solidLogic.store.nextSymbol(targetdoc);
1315
-
1316
- outline.UserInput.fillInRequest('object', selectedTd, newTerm); // selection is changed
1317
-
1179
+ outline.UserInput.fillInRequest('object', selectedTd, newTerm);
1180
+ // selection is changed
1318
1181
  outline.outlineExpand(outline.getSelection()[0], newTerm);
1319
1182
  },
1320
1183
  inputURI: function inputURI(_e) {
@@ -1325,25 +1188,19 @@ module.exports = function UserInput(outline) {
1325
1188
  var tiptext = ' (Type a URI) ';
1326
1189
  This.lastModified = This.createInputBoxIn(selectedTd, tiptext);
1327
1190
  This.lastModified.select();
1328
-
1329
1191
  function typeURIhandler(e) {
1330
1192
  e.stopPropagation();
1331
-
1332
1193
  switch (e.keyCode) {
1333
1194
  case 13: // enter
1334
-
1335
1195
  case 9:
1336
1196
  // tab
1337
1197
  // this is input box
1338
1198
  if (this.value !== tiptext) {
1339
1199
  var newuri = this.value; // @@ Removed URI "fixup" code
1340
-
1341
1200
  This.fillInRequest('object', selectedTd, _solidLogic.store.sym(newuri));
1342
1201
  }
1343
-
1344
1202
  }
1345
1203
  }
1346
-
1347
1204
  This.lastModified.addEventListener('keypress', typeURIhandler, false);
1348
1205
  /*
1349
1206
  if (false && UI.isExtension){
@@ -1359,45 +1216,42 @@ module.exports = function UserInput(outline) {
1359
1216
  }
1360
1217
  */
1361
1218
  },
1219
+
1362
1220
  appendToPredicate: function appendToPredicate(predicateTd) {
1363
1221
  var isEnd = false;
1364
1222
  var trIterator;
1365
-
1366
1223
  try {
1367
- for (trIterator = predicateTd.parentNode.nextSibling; trIterator.childNodes.length === 1 && trIterator.AJAR_statement; // number of nodes as condition, also beware of toggle Trs that don't have AJAR_statement
1368
- trIterator = trIterator.nextSibling) {// ..
1224
+ for (trIterator = predicateTd.parentNode.nextSibling; trIterator.childNodes.length === 1 && trIterator.AJAR_statement;
1225
+ // number of nodes as condition, also beware of toggle Trs that don't have AJAR_statement
1226
+ trIterator = trIterator.nextSibling) {
1227
+ // ..
1369
1228
  }
1370
1229
  } catch (e) {
1371
1230
  isEnd = true;
1372
- } // if(!isEnd && HCIoptions["bottom insert highlights"].enabled) trIterator=trIterator.previousSibling;
1373
-
1374
-
1375
- var insertTr = myDocument.createElement('tr'); // style stuff, I'll have to investigate appendPropertyTRs() somehow
1231
+ }
1232
+ // if(!isEnd && HCIoptions["bottom insert highlights"].enabled) trIterator=trIterator.previousSibling;
1376
1233
 
1234
+ var insertTr = myDocument.createElement('tr');
1235
+ // style stuff, I'll have to investigate appendPropertyTRs() somehow
1377
1236
  insertTr.style.colspan = '1';
1378
1237
  insertTr.style.display = 'block';
1379
1238
  insertTr.style.display = '';
1380
-
1381
1239
  if (predicateTd.hasAttribute('rowspan')) {
1382
1240
  predicateTd.setAttribute('rowspan', parseInt(predicateTd.getAttribute('rowspan')) + 1);
1383
1241
  }
1384
-
1385
1242
  if (!predicateTd.hasAttribute('rowspan')) {
1386
1243
  predicateTd.setAttribute('rowspan', '2');
1387
1244
  }
1388
-
1389
1245
  if (!isEnd) {
1390
1246
  trIterator.parentNode.insertBefore(insertTr, trIterator);
1391
1247
  } else {
1392
1248
  var table = predicateTd.parentNode.parentNode;
1393
-
1394
1249
  if (table.className === 'defaultPane') {
1395
1250
  table.insertBefore(insertTr, table.lastChild);
1396
1251
  } else {
1397
1252
  table.appendChild(insertTr);
1398
1253
  }
1399
1254
  }
1400
-
1401
1255
  return insertTr;
1402
1256
  },
1403
1257
  bnode2symbol: function bnode2symbol(bnode, symbol) {
@@ -1405,51 +1259,46 @@ module.exports = function UserInput(outline) {
1405
1259
  },
1406
1260
  generateRequest: function generateRequest(tipText, trNew, isPredicate, notShow) {
1407
1261
  var trNode;
1408
-
1409
1262
  if (!notShow) {
1410
1263
  if (trNew) {
1411
1264
  trNode = trNew;
1412
1265
  } else {
1413
1266
  trNode = UI.utils.ancestor(this.lastModified, 'TR');
1414
1267
  }
1415
-
1416
1268
  UI.utils.emptyNode(trNode);
1417
- } // create the undetermined term
1269
+ }
1270
+
1271
+ // create the undetermined term
1418
1272
  // Choice 1:
1419
1273
  // var reqTerm=kb.literal("TBD");
1420
1274
  // this is troblesome since RDFIndexedFormula does not allow me to add <x> <y> "TBD". twice
1421
1275
  // Choice 2: Use a variable.
1422
1276
  // Agreed. Kenny wonders whether there is RDF/XML representation of a variable.
1423
1277
  // labelPriority[UI.ns.link('message').uri] = 20;
1424
- // We must get rid of this clutter in the store. "OK, will be stroed in a seperate formula to avoid bugs", Kenny says
1425
-
1426
1278
 
1279
+ // We must get rid of this clutter in the store. "OK, will be stroed in a seperate formula to avoid bugs", Kenny says
1427
1280
  var tp = TempFormula;
1428
1281
  var reqTerm = tp.bnode();
1429
1282
  tp.add(reqTerm, UI.ns.rdf('type'), UI.ns.link('Request'));
1430
-
1431
1283
  if (tipText.length < 10) {
1432
1284
  tp.add(reqTerm, UI.ns.link('message'), tp.literal(tipText));
1433
1285
  } else {
1434
1286
  tp.add(reqTerm, UI.ns.link('message'), tp.literal(tipText));
1435
1287
  }
1436
-
1437
1288
  tp.add(reqTerm, UI.ns.link('to'), tp.literal('The User'));
1438
- tp.add(reqTerm, UI.ns.link('from'), tp.literal('The User')); // append the undetermined td
1289
+ tp.add(reqTerm, UI.ns.link('from'), tp.literal('The User'));
1439
1290
 
1291
+ // append the undetermined td
1440
1292
  if (!notShow) {
1441
1293
  var newNode;
1442
-
1443
1294
  if (isPredicate) {
1444
1295
  newNode = trNode.appendChild(outline.outlinePredicateTD(reqTerm, trNode, false, false));
1445
1296
  } else {
1446
1297
  newNode = trNode.appendChild(outline.outlineObjectTD(reqTerm));
1447
1298
  }
1448
-
1449
1299
  newNode.className = 'undetermined';
1450
1300
  newNode.textContent = tipText;
1451
1301
  }
1452
-
1453
1302
  return reqTerm;
1454
1303
  },
1455
1304
  showMenu: function showMenu(e, menuType, inputQuery, extraInformation, _order) {
@@ -1459,58 +1308,54 @@ module.exports = function UserInput(outline) {
1459
1308
  var This = this;
1460
1309
  var menu = myDocument.createElement('div');
1461
1310
  qp('\n**** In showMenu, menuType = ' + menuType + '\n');
1462
-
1463
1311
  if (extraInformation) {
1464
1312
  for (var x in extraInformation) {
1465
1313
  console.log('\t extra ' + x + ': ' + extraInformation[x] + '\n');
1466
1314
  }
1467
1315
  }
1468
-
1469
1316
  console.log('CREATED MENU\n'); // hq
1470
-
1471
1317
  menu.id = this.menuID;
1472
- menu.className = 'outlineMenu'; // menu.addEventListener('click',false);
1473
-
1318
+ menu.className = 'outlineMenu';
1319
+ // menu.addEventListener('click',false);
1474
1320
  menu.style.top = e.pageY + 'px';
1475
- menu.style.left = e.pageX + 'px'; /// /For pubsPane
1321
+ menu.style.left = e.pageX + 'px';
1322
+
1323
+ /// /For pubsPane
1476
1324
  // This is for setting the location of the dropdown menu, because
1477
1325
  // JournalTitleAutoComplete is called with a keypress, and not mouse actions
1478
1326
  // Get Offset of an HTML element
1479
-
1480
1327
  var getOffset = function getOffset(el) {
1481
1328
  var _lf = 0;
1482
1329
  var _tp = 0;
1483
1330
  var oldlf = 0;
1484
1331
  var oldtp = 0;
1485
1332
  var newlf = 0;
1486
- var newtp = 0; // repeatedly get ancestor's positions
1487
- // TODO: STILL a small offset/bug
1333
+ var newtp = 0;
1488
1334
 
1335
+ // repeatedly get ancestor's positions
1336
+ // TODO: STILL a small offset/bug
1489
1337
  while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
1490
1338
  newlf = el.offsetLeft;
1491
- newtp = el.offsetTop; // only change if the new parent's offset is different
1339
+ newtp = el.offsetTop;
1492
1340
 
1341
+ // only change if the new parent's offset is different
1493
1342
  if (newlf !== oldlf) {
1494
1343
  _lf += el.offsetLeft - el.scrollLeft;
1495
1344
  }
1496
-
1497
1345
  if (newtp !== oldtp) {
1498
1346
  _tp += el.offsetTop - el.scrollTop;
1499
1347
  }
1500
-
1501
1348
  oldlf = newlf;
1502
1349
  oldtp = newtp;
1503
1350
  el = el.parentNode;
1504
- } // there is a constant offset
1505
-
1506
-
1351
+ }
1352
+ // there is a constant offset
1507
1353
  return {
1508
1354
  top: _tp + 54,
1509
1355
  left: _lf - 38
1510
1356
  };
1511
- }; // Change the position of menu in pubsPane's journal Title AC
1512
-
1513
-
1357
+ };
1358
+ // Change the position of menu in pubsPane's journal Title AC
1514
1359
  if (menuType === 'JournalTitleAutoComplete') {
1515
1360
  // hql
1516
1361
  var loc = getOffset(myDocument.getElementById('inpid_journal_title'));
@@ -1518,203 +1363,168 @@ module.exports = function UserInput(outline) {
1518
1363
  menu.style.top = loc.top + 'px';
1519
1364
  menu.style.left = loc.left + 'px';
1520
1365
  }
1521
-
1522
1366
  console.log('menu at top=' + menu.style.top + ' left=' + menu.style.left + '\n'); // hql
1523
1367
  // \\\\\\\hql
1524
1368
 
1525
1369
  myDocument.body.appendChild(menu);
1526
1370
  var table = menu.appendChild(myDocument.createElement('table'));
1527
1371
  menu.lastHighlight = null;
1528
-
1529
1372
  function highlightTr(e) {
1530
1373
  if (menu.lastHighlight) menu.lastHighlight.className = '';
1531
1374
  menu.lastHighlight = UI.utils.ancestor(UI.utils.getTarget(e), 'TR');
1532
1375
  if (!menu.lastHighlight) return; // mouseover <TABLE>
1533
-
1534
1376
  menu.lastHighlight.className = 'activeItem';
1535
1377
  }
1378
+ table.addEventListener('mouseover', highlightTr, false);
1536
1379
 
1537
- table.addEventListener('mouseover', highlightTr, false); // setting for action after selecting item
1538
-
1380
+ // setting for action after selecting item
1539
1381
  var selectItem;
1540
-
1541
1382
  switch (menuType) {
1542
1383
  case 'DidYouMeanDialog':
1543
1384
  selectItem = function selectItem(e) {
1544
1385
  qp('DID YOU MEAN SELECT ITEM!!!!!');
1545
1386
  var target = UI.utils.ancestor(UI.utils.getTarget(e), 'TR');
1546
-
1547
1387
  if (target.childNodes.length === 2 && target.nextSibling) {
1548
1388
  // Yes
1549
1389
  _solidLogic.store.add(bnodeTerm, IDpredicate, IDterm); // used to connect the two
1550
-
1551
-
1552
1390
  outline.UserInput.clearMenu();
1553
1391
  } else if (target.childNodes.length === 2) {
1554
1392
  outline.UserInput.clearMenu();
1555
1393
  }
1556
1394
  };
1557
-
1558
1395
  break;
1559
-
1560
1396
  case 'LimitedPredicateChoice':
1561
1397
  {
1562
1398
  var clickedTd = extraInformation.clickedTd;
1563
-
1564
1399
  selectItem = function selectItem(e) {
1565
1400
  qp('LIMITED P SELECT ITEM!!!!');
1566
1401
  var selectedPredicate = UI.utils.getAbout(_solidLogic.store, UI.utils.getTarget(e));
1567
1402
  var predicateChoices = clickedTd.parentNode.AJAR_statement.predicate.elements;
1568
-
1569
1403
  for (var i = 0; i < predicateChoices.length; i++) {
1570
1404
  if (predicateChoices[i].sameTerm(selectedPredicate)) {
1571
1405
  predicateChoices.unshift(predicateChoices.splice(i, 1)[0]);
1572
1406
  }
1573
1407
  }
1408
+ outline.UserInput.clearMenu();
1574
1409
 
1575
- outline.UserInput.clearMenu(); // refresh the choice
1576
-
1410
+ // refresh the choice
1577
1411
  var tr = clickedTd.parentNode;
1578
1412
  var newTd = outline.outlinePredicateTD(tr.AJAR_statement.predicate, tr);
1579
1413
  tr.insertBefore(newTd, clickedTd);
1580
1414
  tr.removeChild(clickedTd);
1581
1415
  This.lastModified.select();
1582
1416
  };
1583
-
1584
1417
  break;
1585
1418
  }
1586
-
1587
1419
  case 'PredicateAutoComplete':
1588
1420
  case 'GeneralAutoComplete':
1589
1421
  case 'GeneralPredicateChoice':
1590
1422
  case 'JournalTitleAutoComplete': // hql
1591
-
1592
1423
  case 'TypeChoice':
1593
1424
  {
1594
1425
  // Clickable menu
1595
1426
  var isPredicate = extraInformation.isPredicate;
1596
1427
  var selectedTd = extraInformation.selectedTd;
1597
-
1598
1428
  selectItem = function selectItem(e) {
1599
1429
  qp('WOOHOO');
1600
1430
  var inputTerm = UI.utils.getAbout(_solidLogic.store, UI.utils.getTarget(e));
1601
1431
  qp('GENERAL SELECT ITEM!!!!!!=' + inputTerm);
1602
1432
  qp('target=' + UI.utils.getTarget(e));
1603
-
1604
1433
  if (isPredicate) {
1605
1434
  qp('1');
1606
-
1607
1435
  if (outline.UserInput.fillInRequest('predicate', selectedTd, inputTerm)) {
1608
1436
  qp('2');
1609
1437
  outline.UserInput.clearMenu();
1610
1438
  }
1611
1439
  } else {
1612
- qp('3'); // thisInput.fillInRequest('object',selectedTd,inputTerm); //why is this not working?
1613
-
1440
+ qp('3');
1441
+ // thisInput.fillInRequest('object',selectedTd,inputTerm); //why is this not working?
1614
1442
  if (outline.UserInput.fillInRequest('object', selectedTd, inputTerm)) {
1615
1443
  qp('4');
1616
1444
  outline.UserInput.clearMenu();
1617
1445
  }
1618
1446
  }
1619
1447
  };
1620
-
1621
1448
  break;
1622
1449
  }
1623
-
1624
1450
  default:
1625
1451
  throw new Error('userinput: unexpected mode');
1626
- } // hq: this line makes the menu clickable
1627
-
1452
+ }
1453
+ // hq: this line makes the menu clickable
1454
+ table.addEventListener('click', selectItem, false);
1628
1455
 
1629
- table.addEventListener('click', selectItem, false); // Add Items to the list
1456
+ // Add Items to the list
1630
1457
  // build NameSpaces here from knowledge base
1631
-
1632
- var NameSpaces = {}; // for each (ontology in ontologies)
1633
-
1458
+ var NameSpaces = {};
1459
+ // for each (ontology in ontologies)
1634
1460
  _solidLogic.store.each(undefined, UI.ns.rdf('type'), UI.ns.owl('Ontology')).forEach(function (ontology) {
1635
1461
  var label = UI.utils.label(ontology);
1636
- if (!label) return; // this is like extracting metadata from URI. Maybe it's better not to take the abbrevs.
1637
-
1462
+ if (!label) return;
1463
+ // this is like extracting metadata from URI. Maybe it's better not to take the abbrevs.
1638
1464
  var match = label.value.match(/\((.+?)\)/);
1639
-
1640
1465
  if (match) {
1641
1466
  NameSpaces[match[1]] = ontology.uri;
1642
1467
  } else {
1643
1468
  NameSpaces[label.value] = ontology.uri;
1644
1469
  }
1645
1470
  });
1646
-
1647
1471
  function addMenuItem(predicate) {
1648
1472
  if (table.firstChild && table.firstChild.className === 'no-suggest') {
1649
1473
  table.removeChild(table.firstChild);
1650
1474
  }
1651
-
1652
- var Label = UI.utils.predicateLabelForXML(predicate, false); // Label = Label.slice(0,1).toUpperCase() + Label.slice(1);
1475
+ var Label = UI.utils.predicateLabelForXML(predicate, false);
1476
+ // Label = Label.slice(0,1).toUpperCase() + Label.slice(1);
1653
1477
 
1654
1478
  if (!predicate.uri) return; // bnode
1655
-
1656
1479
  var theNamespace = '??';
1657
-
1658
1480
  for (var name in NameSpaces) {
1659
1481
  UI.log.debug(NameSpaces[name]);
1660
-
1661
1482
  if (UI.rdf.Util.string_startswith(predicate.uri, NameSpaces[name])) {
1662
1483
  theNamespace = name;
1663
1484
  break;
1664
1485
  }
1665
1486
  }
1666
-
1667
1487
  var tr = table.appendChild(myDocument.createElement('tr'));
1668
1488
  tr.setAttribute('about', predicate);
1669
1489
  var th = tr.appendChild(myDocument.createElement('th'));
1670
1490
  th.appendChild(myDocument.createElement('div')).appendChild(myDocument.createTextNode(Label));
1671
1491
  tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode(theNamespace.toUpperCase()));
1672
1492
  }
1673
-
1674
1493
  function addPredicateChoice(selectedQuery) {
1675
1494
  return function (bindings) {
1676
1495
  var predicate = bindings[selectedQuery.vars[0]];
1677
1496
  addMenuItem(predicate);
1678
1497
  };
1679
1498
  }
1680
-
1681
1499
  function clearMenu(e) {
1682
1500
  This.clearMenu();
1683
1501
  e.stopPropagation();
1684
1502
  }
1685
-
1686
1503
  var inputText;
1687
1504
  var bnodeTerm;
1688
1505
  var IDpredicate;
1689
1506
  var IDterm;
1690
1507
  var tr;
1691
1508
  var th;
1692
-
1693
1509
  switch (menuType) {
1694
1510
  case 'DidYouMeanDialog':
1695
1511
  {
1696
1512
  var dialogTerm = extraInformation.dialogTerm;
1697
- bnodeTerm = extraInformation.bnodeTerm; // have to do style instruction passing
1698
-
1513
+ bnodeTerm = extraInformation.bnodeTerm;
1514
+ // have to do style instruction passing
1699
1515
  menu.style.width = 'auto';
1700
1516
  var h1 = table.appendChild(myDocument.createElement('tr'));
1701
1517
  var h1th = h1.appendChild(myDocument.createElement('th'));
1702
1518
  h1th.appendChild(myDocument.createTextNode('Did you mean...'));
1703
-
1704
1519
  var plist = _solidLogic.store.statementsMatching(dialogTerm);
1705
-
1706
1520
  var i;
1707
-
1708
1521
  for (i = 0; i < plist.length; i++) {
1709
1522
  if (_solidLogic.store.whether(plist[i].predicate, rdf('type'), UI.ns.owl('InverseFunctionalProperty'))) {
1710
1523
  break;
1711
1524
  }
1712
1525
  }
1713
-
1714
1526
  var _IDpredicate = plist[i].predicate;
1715
-
1716
1527
  var _IDterm = _solidLogic.store.any(dialogTerm, plist[i].predicate);
1717
-
1718
1528
  var text = UI.utils.label(dialogTerm) + ' who has ' + UI.utils.label(_IDpredicate) + ' ' + _IDterm + '?';
1719
1529
  var h2 = table.appendChild(myDocument.createElement('tr'));
1720
1530
  var h2th = h2.appendChild(myDocument.createElement('th'));
@@ -1729,85 +1539,68 @@ module.exports = function UserInput(outline) {
1729
1539
  ans2.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode('BOOLEAN'));
1730
1540
  break;
1731
1541
  }
1732
-
1733
1542
  case 'PredicateAutoComplete':
1734
1543
  // Prompt user for possible relationships for new data
1735
1544
  inputText = extraInformation.inputText;
1736
1545
  /* The labeller functionality code ahs been lost or dropped -- reinstate this? */
1737
1546
  // @@ TODO: Write away the need for exception on next line
1738
1547
  // eslint-disable-next-line no-case-declarations
1739
-
1740
- var predicates = outline.labeller.searchAdv(inputText, undefined, 'predicate'); // @@ TODO: Write away the need for exception on next line
1548
+ var predicates = outline.labeller.searchAdv(inputText, undefined, 'predicate');
1549
+ // @@ TODO: Write away the need for exception on next line
1741
1550
  // eslint-disable-next-line no-case-declarations
1742
-
1743
1551
  var results = []; // @@ fixme
1744
-
1745
1552
  for (var _i = 0; _i < predicates.length; _i++) {
1746
1553
  var tempQuery = {};
1747
1554
  tempQuery.vars = [];
1748
1555
  tempQuery.vars.push('Kenny');
1749
1556
  var tempBinding = {};
1750
1557
  tempBinding.Kenny = _solidLogic.store.fromNT(predicates[_i].NT);
1751
-
1752
1558
  try {
1753
1559
  addPredicateChoice(tempQuery)(tempBinding);
1754
1560
  } catch (e) {
1755
1561
  throw new Error("I'll deal with bnodes later...[Kenny]" + e);
1756
1562
  } // I'll deal with bnodes later...
1563
+ }
1757
1564
 
1758
- } // @@ TODO: Write away the need for exception on next line
1565
+ // @@ TODO: Write away the need for exception on next line
1759
1566
  // eslint-disable-next-line no-case-declarations
1760
-
1761
-
1762
1567
  var entries = results[0];
1763
-
1764
1568
  if (entries.length === 0) {
1765
1569
  console.log('cm length 0\n'); // hq
1766
-
1767
1570
  this.clearMenu();
1768
1571
  return;
1769
1572
  }
1770
-
1771
1573
  for (var _i2 = 0; _i2 < entries.length && _i2 < 10; _i2++) {
1772
1574
  // do not show more than 30 items
1773
1575
  addMenuItem(entries[_i2][1]);
1774
1576
  }
1775
-
1776
1577
  break;
1777
-
1778
1578
  case 'GeneralAutoComplete':
1779
1579
  {
1780
1580
  inputText = extraInformation.inputText;
1781
-
1782
1581
  try {
1783
1582
  results = outline.labeller.search(inputText);
1784
1583
  } catch (e) {
1785
1584
  console.log('GeneralAutoComplete: debug me ' + extraInformation.selectedTd.textContent + '\n' + e + '\n');
1786
1585
  }
1787
-
1788
1586
  entries = results[0]; // [label, subject,priority]
1789
-
1790
1587
  var types = results[1];
1791
-
1792
1588
  if (entries.length === 0) {
1793
1589
  console.log('cm length 0\n'); // hq
1794
-
1795
1590
  this.clearMenu();
1796
1591
  return;
1797
1592
  }
1798
-
1799
1593
  for (var _i3 = 0; _i3 < entries.length && _i3 < 10; _i3++) {
1800
1594
  // do not show more than 30 items
1801
1595
  // console.log("\nGEN ENTRIES["+i+"] = "+entries[i]+"\n");//hq
1802
- var thisNT = entries[_i3][1].toNT(); // console.log("thisNT="+thisNT+"\n");
1803
-
1804
-
1596
+ var thisNT = entries[_i3][1].toNT();
1597
+ // console.log("thisNT="+thisNT+"\n");
1805
1598
  tr = table.appendChild(myDocument.createElement('tr'));
1806
1599
  tr.setAttribute('about', thisNT);
1807
1600
  th = tr.appendChild(myDocument.createElement('th'));
1808
- th.appendChild(myDocument.createElement('div')).appendChild(myDocument.createTextNode(entries[_i3][0])); // var theTerm = entries[i][1]
1601
+ th.appendChild(myDocument.createElement('div')).appendChild(myDocument.createTextNode(entries[_i3][0]));
1602
+ // var theTerm = entries[i][1]
1809
1603
  // var type=theTerm?kb.any(kb.fromNT(thisNT),rdf('type')):undefined;
1810
-
1811
1604
  var type = types[_i3];
1812
1605
  var typeLabel = type ? UI.utils.label(type) : '';
1813
1606
  tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode(typeLabel));
@@ -1828,98 +1621,80 @@ module.exports = function UserInput(outline) {
1828
1621
  tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode(typeLabel));
1829
1622
  }
1830
1623
  */
1831
-
1832
-
1833
1624
  break;
1834
1625
  }
1835
-
1836
1626
  case 'JournalTitleAutoComplete':
1837
1627
  {
1838
1628
  // hql
1839
1629
  // HEART OF JOURNAL TITLE AUTOCOMPLETE
1630
+
1840
1631
  // extraInformatin is from above getAutoCompleteHandler
1841
1632
  inputText = extraInformation.inputText;
1842
1633
  console.log('testing searching text= ' + inputText + ' =====\n');
1843
- console.log('\n===start JournalTitleAutoComplete\n'); // Gets all the URI's with type Journal in the knowledge base
1634
+ console.log('\n===start JournalTitleAutoComplete\n');
1844
1635
 
1636
+ // Gets all the URI's with type Journal in the knowledge base
1845
1637
  var juris = _solidLogic.store.each(undefined, rdf('type'), bibo('Journal'));
1846
-
1847
1638
  var matchedtitle = []; // debugging display before inserts into menu
1848
1639
 
1849
1640
  for (var _i4 = 0; _i4 < juris.length; _i4++) {
1850
1641
  var juri = juris[_i4];
1851
-
1852
1642
  var jtitle = _solidLogic.store.each(juri, dcelems('title'), undefined);
1853
-
1854
1643
  var jtstr = jtitle + '';
1855
1644
  var matchstr = inputText.toLowerCase();
1856
- var jTitleLowerCase = jtstr.toLowerCase(); // If the inputText as a whole is contained in a journal title
1645
+ var jTitleLowerCase = jtstr.toLowerCase();
1857
1646
 
1647
+ // If the inputText as a whole is contained in a journal title
1858
1648
  if (jTitleLowerCase.search(matchstr) !== -1) {
1859
1649
  qp('FOUND A Journal Title Match!!!!!!');
1860
- matchedtitle.push(jtitle); // Add it as a row to the menu:
1861
- // === Title, URI ==
1650
+ matchedtitle.push(jtitle);
1862
1651
 
1652
+ // Add it as a row to the menu:
1653
+ // === Title, URI ==
1863
1654
  var _tr = table.appendChild(myDocument.createElement('tr'));
1864
-
1865
1655
  _tr.setAttribute('about', 'journalTitle');
1866
-
1867
1656
  var _th = _tr.appendChild(myDocument.createElement('th'));
1868
-
1869
1657
  _th.appendChild(myDocument.createElement('div')).appendChild(myDocument.createTextNode(jtitle));
1870
-
1871
1658
  _tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode(juri));
1872
1659
  }
1873
1660
  }
1874
-
1875
1661
  console.log('matched: ' + matchedtitle + '\n');
1876
1662
  console.log("\\\\done showMenu's JTAutocomplete\n");
1877
1663
  break;
1878
1664
  }
1879
-
1880
1665
  case 'LimitedPredicateChoice':
1881
1666
  {
1882
- var choiceTerm = UI.utils.getAbout(_solidLogic.store, extraInformation.clickedTd); // because getAbout relies on kb.fromNT, which does not deal with
1667
+ var choiceTerm = UI.utils.getAbout(_solidLogic.store, extraInformation.clickedTd);
1668
+ // because getAbout relies on kb.fromNT, which does not deal with
1883
1669
  // the 'Collection' termType. This termType is ambiguous anyway.
1884
-
1885
1670
  choiceTerm.termType = 'Collection';
1886
-
1887
1671
  var choices = _solidLogic.store.each(choiceTerm, UI.ns.link('element'));
1888
-
1889
1672
  for (var _i5 = 0; _i5 < choices.length; _i5++) {
1890
1673
  addMenuItem(choices[_i5]);
1891
1674
  }
1892
-
1893
1675
  break;
1894
1676
  }
1895
-
1896
1677
  default:
1897
1678
  {
1898
1679
  tr = table.appendChild(myDocument.createElement('tr'));
1899
1680
  tr.className = 'no-suggest';
1900
1681
  th = tr.appendChild(myDocument.createElement('th'));
1901
1682
  th.appendChild(myDocument.createElement('div')).appendChild(myDocument.createTextNode('No suggested choices. Try to type instead.'));
1902
- tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode('OK')); // var This = this
1903
-
1683
+ tr.appendChild(myDocument.createElement('td')).appendChild(myDocument.createTextNode('OK'));
1684
+ // var This = this
1904
1685
  tr.addEventListener('click', clearMenu, 'false');
1905
-
1906
1686
  var nullFetcher = function nullFetcher() {};
1907
-
1908
1687
  switch (inputQuery.constructor.name) {
1909
1688
  case 'Array':
1910
1689
  for (var _i6 = 0; _i6 < inputQuery.length; _i6++) {
1911
1690
  _solidLogic.store.query(inputQuery[_i6], addPredicateChoice(inputQuery[_i6]), nullFetcher);
1912
1691
  }
1913
-
1914
1692
  break;
1915
-
1916
1693
  case 'undefined':
1917
1694
  throw new Error('addPredicateChoice: query is not defined');
1918
1695
  // break
1919
-
1920
1696
  default:
1921
1697
  _solidLogic.store.query(inputQuery, addPredicateChoice(inputQuery), nullFetcher);
1922
-
1923
1698
  }
1924
1699
  }
1925
1700
  }
@@ -1930,17 +1705,18 @@ module.exports = function UserInput(outline) {
1930
1705
  fillInRequest: function fillInRequest(type, selectedTd, inputTerm) {
1931
1706
  var tr = selectedTd.parentNode;
1932
1707
  var stat;
1933
- var isInverse; // eslint-disable-next-line prefer-const
1934
-
1935
- stat = tr.AJAR_statement; // eslint-disable-next-line prefer-const
1936
-
1708
+ var isInverse;
1709
+ // eslint-disable-next-line prefer-const
1710
+ stat = tr.AJAR_statement;
1711
+ // eslint-disable-next-line prefer-const
1937
1712
  isInverse = tr.AJAR_inverse;
1938
1713
  var reqTerm = type === 'object' ? stat.object : stat.predicate;
1939
1714
  var newStat;
1940
- var doNext = false; // RDF Event
1715
+ var doNext = false;
1941
1716
 
1942
- var eventhandler;
1717
+ // RDF Event
1943
1718
 
1719
+ var eventhandler;
1944
1720
  if (_solidLogic.store.any(reqTerm, UI.ns.link('onfillin'))) {
1945
1721
  /* 2017 -- Not sure what is supposed to happen here -- timbl @@@@
1946
1722
  eventhandler = function(subject) {
@@ -1948,14 +1724,11 @@ module.exports = function UserInput(outline) {
1948
1724
  }
1949
1725
  */
1950
1726
  }
1951
-
1952
1727
  if (type === 'predicate') {
1953
1728
  // ToDo: How to link two things with an inverse relationship
1954
1729
  var newTd = outline.outlinePredicateTD(inputTerm, tr, false, false);
1955
-
1956
1730
  if (selectedTd.nextSibling.className !== 'undetermined') {
1957
1731
  var s = new UI.rdf.Statement(stat.subject, inputTerm, stat.object, stat.why);
1958
-
1959
1732
  try {
1960
1733
  _solidLogic.store.updater.update([], [s], function (uri, success, errorBody) {
1961
1734
  if (success) {
@@ -1969,12 +1742,11 @@ module.exports = function UserInput(outline) {
1969
1742
  }
1970
1743
  });
1971
1744
  } catch (e) {
1972
- UI.log.error(e); // Warn the user that the write has failed.
1973
-
1745
+ UI.log.error(e);
1746
+ // Warn the user that the write has failed.
1974
1747
  UI.log.warn('Error when insert (#2) of statement ' + s + ':\n\t' + e);
1975
1748
  return;
1976
1749
  }
1977
-
1978
1750
  newTd.className += ' pendingedit';
1979
1751
  this.lastModified = null;
1980
1752
  } else {
@@ -1982,45 +1754,37 @@ module.exports = function UserInput(outline) {
1982
1754
  outline.walk('right');
1983
1755
  doNext = true;
1984
1756
  }
1985
-
1986
1757
  outline.replaceTD(newTd, selectedTd);
1987
1758
  TempFormula.remove(stat);
1988
1759
  } else if (type === 'object') {
1989
1760
  // Object value has been edited
1990
1761
  var _newTd = outline.outlineObjectTD(inputTerm);
1991
-
1992
1762
  outline.replaceTD(_newTd, selectedTd);
1993
-
1994
1763
  if (!selectedTd.previousSibling || selectedTd.previousSibling.className !== 'undetermined') {
1995
1764
  var _s;
1996
-
1997
1765
  if (!isInverse) {
1998
1766
  _s = new UI.rdf.Statement(stat.subject, stat.predicate, inputTerm, stat.why);
1999
1767
  } else {
2000
1768
  _s = new UI.rdf.Statement(inputTerm, stat.predicate, stat.object, stat.why);
2001
1769
  }
2002
-
2003
1770
  try {
2004
1771
  _solidLogic.store.updater.update([], [_s], function (uri, success, _errorBody) {
2005
1772
  UI.log.info('@@ usinput.js (object) callback ok=' + success + ' for statement:' + _s + '\n ');
2006
1773
  var newStats;
2007
-
2008
1774
  if (success) {
2009
1775
  _newTd.className = _newTd.className.replace(/ pendingedit/g, ''); // User feedback
2010
-
2011
1776
  if (!isInverse) {
2012
1777
  newStats = _solidLogic.store.statementsMatching(stat.subject, stat.predicate, inputTerm, stat.why);
2013
1778
  } else {
2014
1779
  newStats = _solidLogic.store.statementsMatching(inputTerm, stat.predicate, stat.object, stat.why);
2015
1780
  }
2016
-
2017
1781
  if (!newStats.length) {
2018
1782
  UI.log.error("userinput.js 1711: Can't find statememt!");
2019
1783
  }
2020
-
2021
1784
  tr.AJAR_statement = newStats[0];
2022
1785
  } else {
2023
- UI.log.warn('userinput.js (object): Fail trying to insert statement ' + _s); // outline.UserInput.deleteTriple(newTd,true);
1786
+ UI.log.warn('userinput.js (object): Fail trying to insert statement ' + _s);
1787
+ // outline.UserInput.deleteTriple(newTd,true);
2024
1788
  }
2025
1789
  });
2026
1790
  } catch (e) {
@@ -2029,30 +1793,26 @@ module.exports = function UserInput(outline) {
2029
1793
  UI.log.warn('Error trying to insert statement ' + _s + ':\n' + e);
2030
1794
  return;
2031
1795
  }
2032
-
2033
1796
  this.lastModified = null;
2034
1797
  _newTd.className += ' pendingedit';
2035
1798
  } else {
2036
1799
  // ?this.formUndetStat(tr...)
2037
1800
  outline.walk('left');
2038
1801
  doNext = true;
2039
- } // removal of the undetermined statement
2040
-
2041
-
1802
+ }
1803
+ // removal of the undetermined statement
2042
1804
  TempFormula.remove(stat);
2043
- } // do not throw away user's work even update fails
2044
-
2045
-
1805
+ }
1806
+ // do not throw away user's work even update fails
2046
1807
  UserInputFormula.statements.push(newStat);
2047
1808
  if (eventhandler) eventhandler(stat.subject);
2048
-
2049
1809
  if (doNext) {
2050
1810
  this.startFillInText(outline.getSelection()[0]);
2051
1811
  } else {
2052
1812
  return true;
2053
1813
  } // can clearMenu
2054
-
2055
1814
  },
1815
+
2056
1816
  formUndetStat: function formUndetStat(trNode, subject, predicate, object, why, inverse) {
2057
1817
  trNode.AJAR_inverse = inverse;
2058
1818
  trNode.AJAR_statement = TempFormula.add(subject, predicate, object, why);