solid-panes 3.5.27 → 3.5.28-59efa615

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