solid-panes 3.5.18-5dfe2dbf → 3.5.18-a4dc4f9c
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.
- package/dev/loader.ts +11 -11
- package/lib/argument/argumentPane.js +7 -15
- package/lib/argument/argumentPane.js.map +1 -1
- package/lib/dashboard/basicPreferences.d.ts.map +1 -1
- package/lib/dashboard/basicPreferences.js +6 -6
- package/lib/dashboard/basicPreferences.js.map +1 -1
- package/lib/dashboard/dashboardPane.d.ts.map +1 -1
- package/lib/dashboard/dashboardPane.js +4 -6
- package/lib/dashboard/dashboardPane.js.map +1 -1
- package/lib/dataContentPane.js +1 -1
- package/lib/dataContentPane.js.map +1 -1
- package/lib/form/pane.js +6 -15
- package/lib/form/pane.js.map +1 -1
- package/lib/home/homePane.d.ts.map +1 -1
- package/lib/home/homePane.js +5 -7
- package/lib/home/homePane.js.map +1 -1
- package/lib/index.d.ts +3 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -15
- package/lib/index.js.map +1 -1
- package/lib/mainPage/header.d.ts.map +1 -1
- package/lib/mainPage/header.js +2 -4
- package/lib/mainPage/header.js.map +1 -1
- package/lib/microblogPane/microblogPane.js +14 -16
- package/lib/microblogPane/microblogPane.js.map +1 -1
- package/lib/outline/dragDrop.js +6 -16
- package/lib/outline/dragDrop.js.map +1 -1
- package/lib/outline/licenseOptions.js +5 -12
- package/lib/outline/licenseOptions.js.map +1 -1
- package/lib/outline/manager.js +21 -29
- package/lib/outline/manager.js.map +1 -1
- package/lib/outline/queryByExample.js +6 -14
- package/lib/outline/queryByExample.js.map +1 -1
- package/lib/outline/userInput.js +80 -90
- package/lib/outline/userInput.js.map +1 -1
- package/lib/pad/padPane.d.ts.map +1 -1
- package/lib/pad/padPane.js +4 -6
- package/lib/pad/padPane.js.map +1 -1
- package/lib/profile/editProfile.view.d.ts.map +1 -1
- package/lib/profile/editProfile.view.js +3 -3
- package/lib/profile/editProfile.view.js.map +1 -1
- package/lib/schedule/schedulePane.js +14 -26
- package/lib/schedule/schedulePane.js.map +1 -1
- package/lib/socialPane.js +6 -16
- package/lib/socialPane.js.map +1 -1
- package/lib/transaction/pane.js +1 -1
- package/lib/transaction/pane.js.map +1 -1
- package/lib/transaction/period.js +1 -1
- package/lib/transaction/period.js.map +1 -1
- package/lib/trip/tripPane.js +1 -1
- package/lib/trip/tripPane.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.dom.d.ts.map +1 -1
- package/lib/trustedApplications/trustedApplications.dom.js +9 -11
- package/lib/trustedApplications/trustedApplications.dom.js.map +1 -1
- package/lib/trustedApplications/trustedApplications.view.d.ts.map +1 -1
- package/lib/trustedApplications/trustedApplications.view.js +3 -5
- package/lib/trustedApplications/trustedApplications.view.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +13 -13
- package/src/argument/argumentPane.js +5 -5
- package/src/dashboard/basicPreferences.ts +5 -4
- package/src/dashboard/dashboardPane.ts +3 -4
- package/src/dataContentPane.js +1 -1
- package/src/form/pane.js +4 -5
- package/src/home/homePane.ts +6 -7
- package/src/index.ts +18 -24
- package/src/mainPage/header.ts +2 -3
- package/src/microblogPane/microblogPane.js +8 -9
- package/src/outline/dragDrop.js +4 -5
- package/src/outline/licenseOptions.js +5 -4
- package/src/outline/manager.js +21 -22
- package/src/outline/queryByExample.js +4 -4
- package/src/outline/userInput.js +72 -72
- package/src/pad/padPane.ts +3 -3
- package/src/profile/editProfile.view.ts +8 -5
- package/src/schedule/schedulePane.js +13 -14
- package/src/socialPane.js +4 -5
- package/src/transaction/pane.js +1 -1
- package/src/transaction/period.js +1 -1
- package/src/trip/tripPane.js +1 -1
- package/src/trustedApplications/trustedApplications.dom.ts +1 -2
- package/src/trustedApplications/trustedApplications.view.ts +4 -4
- package/src/versionInfo.ts +2 -2
package/lib/outline/userInput.js
CHANGED
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _solidLogic = require("solid-logic");
|
|
3
|
+
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); }
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
// Original author: kennyluck
|
|
7
|
+
//
|
|
8
|
+
// Kenny's Notes:
|
|
9
|
+
|
|
10
|
+
/* places to generate SPARQL update: clearInputAndSave() pasteFromClipboard()->insertTermTo();
|
|
11
|
+
undetermined statement generated formUndetStat()
|
|
12
|
+
->fillInRequest()
|
|
13
|
+
ontological issues
|
|
14
|
+
temporarily using the tabont namespace
|
|
15
|
+
clipboard: 'predicates' 'objects' 'all'(internal)
|
|
16
|
+
request: 'from' 'to' 'message' 'Request'
|
|
17
|
+
*/
|
|
18
|
+
var UI = require('solid-ui');
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
var $rdf = UI.rdf;
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
var panes = require('pane-registry');
|
|
12
23
|
|
|
13
|
-
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
|
-
var $rdf = UI.rdf;
|
|
16
24
|
var UserInputFormula; // Formula to store references of user's work
|
|
17
25
|
|
|
18
26
|
var TempFormula; // Formula to store incomplete triples (Requests),
|
|
19
27
|
// temporarily disjoint with kb to avoid bugs
|
|
20
28
|
|
|
21
29
|
module.exports = function UserInput(outline) {
|
|
30
|
+
var kb = UI.store;
|
|
22
31
|
var myDocument = outline.document; // is this ok?
|
|
23
32
|
// UI.log.warn("myDocument when it's set is "+myDocument.location);
|
|
24
33
|
|
|
@@ -54,16 +63,16 @@ module.exports = function UserInput(outline) {
|
|
|
54
63
|
|
|
55
64
|
if (!UserInputFormula) {
|
|
56
65
|
UserInputFormula = new UI.rdf.Formula();
|
|
57
|
-
UserInputFormula.superFormula =
|
|
66
|
+
UserInputFormula.superFormula = kb; // UserInputFormula.registerFormula("Your Work");
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
if (!TempFormula) TempFormula = new UI.rdf.IndexedFormula(); // Use RDFIndexedFormula so add returns the statement
|
|
61
70
|
|
|
62
71
|
TempFormula.name = 'TempFormula';
|
|
63
|
-
if (!
|
|
72
|
+
if (!UI.store.updater) UI.store.updater = new UI.rdf.UpdateManager(kb);
|
|
64
73
|
return {
|
|
65
74
|
// updateService: updateService,
|
|
66
|
-
sparqler:
|
|
75
|
+
sparqler: UI.store.updater,
|
|
67
76
|
lastModified: null,
|
|
68
77
|
// the last <input> being modified, .isNew indicates whether it's a new input
|
|
69
78
|
lastModifiedStat: null,
|
|
@@ -98,10 +107,8 @@ module.exports = function UserInput(outline) {
|
|
|
98
107
|
This.formUndetStat(insertTr, preStat.subject, reqTerm1, reqTerm2, preStat.why, false);
|
|
99
108
|
} else {
|
|
100
109
|
// no previous row: write to the document defining the subject
|
|
101
|
-
var subject = UI.utils.getAbout(
|
|
102
|
-
|
|
103
|
-
var doc = _solidLogic.store.sym(UI.rdf.Util.uri.docpart(subject.uri));
|
|
104
|
-
|
|
110
|
+
var subject = UI.utils.getAbout(kb, UI.utils.ancestor(target.parentNode.parentNode, 'TD'));
|
|
111
|
+
var doc = kb.sym(UI.rdf.Util.uri.docpart(subject.uri));
|
|
105
112
|
This.formUndetStat(insertTr, subject, reqTerm1, reqTerm2, doc, false);
|
|
106
113
|
}
|
|
107
114
|
|
|
@@ -279,7 +286,7 @@ module.exports = function UserInput(outline) {
|
|
|
279
286
|
obj = UI.utils.getTerm(target);
|
|
280
287
|
trNode = UI.utils.ancestor(target, 'TR');
|
|
281
288
|
} catch (e) {
|
|
282
|
-
UI.log.warn('userinput.js: ' + e + UI.utils.getAbout(
|
|
289
|
+
UI.log.warn('userinput.js: ' + e + UI.utils.getAbout(kb, selectedTd));
|
|
283
290
|
UI.log.error(target + ' getStatement Error:' + e);
|
|
284
291
|
}
|
|
285
292
|
|
|
@@ -394,13 +401,13 @@ module.exports = function UserInput(outline) {
|
|
|
394
401
|
this.clearInputAndSave();
|
|
395
402
|
return;
|
|
396
403
|
} else if (this.lastModified.isNew) {
|
|
397
|
-
s = new UI.rdf.Statement(s.subject, s.predicate,
|
|
404
|
+
s = new UI.rdf.Statement(s.subject, s.predicate, kb.literal(this.lastModified.value), s.why); // TODO: DEFINE ERROR CALLBACK
|
|
398
405
|
|
|
399
406
|
defaultpropview = this.views.defaults[s.predicate.uri];
|
|
400
407
|
trCache = UI.utils.ancestor(this.lastModified, 'TR');
|
|
401
408
|
|
|
402
409
|
try {
|
|
403
|
-
|
|
410
|
+
UI.store.updater.update([], [s], function (uri, success, errorBody) {
|
|
404
411
|
if (!success) {
|
|
405
412
|
UI.log.error('Error occurs while inserting ' + s + '\n\n' + errorBody + '\n'); // UI.log.warn("Error occurs while inserting "+s+'\n\n'+errorBody);
|
|
406
413
|
|
|
@@ -412,7 +419,7 @@ module.exports = function UserInput(outline) {
|
|
|
412
419
|
return;
|
|
413
420
|
}
|
|
414
421
|
|
|
415
|
-
s =
|
|
422
|
+
s = kb.add(s.subject, s.predicate, kb.literal(this.lastModified.value), s.why);
|
|
416
423
|
} else {
|
|
417
424
|
if (this.statIsInverse) {
|
|
418
425
|
UI.log.error("Invalid Input: a literal can't be a subject in RDF/XML");
|
|
@@ -430,10 +437,10 @@ module.exports = function UserInput(outline) {
|
|
|
430
437
|
var valueCache = this.lastModified.value;
|
|
431
438
|
trCache = UI.utils.ancestor(this.lastModified, 'TR');
|
|
432
439
|
var oldValue = this.lastModified.defaultValue;
|
|
433
|
-
s2 = $rdf.st(s.subject, s.predicate,
|
|
440
|
+
s2 = $rdf.st(s.subject, s.predicate, kb.literal(this.lastModified.value), s.why);
|
|
434
441
|
|
|
435
442
|
try {
|
|
436
|
-
|
|
443
|
+
UI.store.updater.update([s], [s2], function (uri, success, errorBody) {
|
|
437
444
|
if (success) {
|
|
438
445
|
obj.value = valueCache;
|
|
439
446
|
} else {
|
|
@@ -457,14 +464,13 @@ module.exports = function UserInput(outline) {
|
|
|
457
464
|
{
|
|
458
465
|
// a request refill with text
|
|
459
466
|
// var newStat
|
|
460
|
-
var textTerm =
|
|
461
|
-
|
|
467
|
+
var textTerm = kb.literal(this.lastModified.value, ''); // <Feature about="labelChoice">
|
|
462
468
|
|
|
463
469
|
if (s.predicate.termType === 'Collection') {
|
|
464
470
|
// case: add triple ????????? Weird - tbl
|
|
465
471
|
var selectedPredicate = s.predicate.elements[0]; // @@ TBL elements is a list on the predicate??
|
|
466
472
|
|
|
467
|
-
if (
|
|
473
|
+
if (kb.any(undefined, selectedPredicate, textTerm)) {
|
|
468
474
|
if (!e) {
|
|
469
475
|
// keyboard
|
|
470
476
|
var tdNode = this.lastModified.parentNode;
|
|
@@ -474,22 +480,20 @@ module.exports = function UserInput(outline) {
|
|
|
474
480
|
}
|
|
475
481
|
|
|
476
482
|
this.showMenu(e, 'DidYouMeanDialog', undefined, {
|
|
477
|
-
dialogTerm:
|
|
483
|
+
dialogTerm: kb.any(undefined, selectedPredicate, textTerm),
|
|
478
484
|
bnodeTerm: s.subject
|
|
479
485
|
});
|
|
480
486
|
} else {
|
|
481
487
|
s1 = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR').parentNode, 'TR').AJAR_statement;
|
|
482
488
|
s2 = $rdf.st(s.subject, selectedPredicate, textTerm, s.why);
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
s3 = _solidLogic.store.anyStatementMatching(s.subject, rdf('type'), type, s.why); // TODO: DEFINE ERROR CALLBACK
|
|
489
|
+
var type = kb.the(s.subject, rdf('type'));
|
|
490
|
+
s3 = kb.anyStatementMatching(s.subject, rdf('type'), type, s.why); // TODO: DEFINE ERROR CALLBACK
|
|
487
491
|
// because the table is repainted, so...
|
|
488
492
|
|
|
489
493
|
trCache = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR'), 'TD').parentNode;
|
|
490
494
|
|
|
491
495
|
try {
|
|
492
|
-
|
|
496
|
+
UI.store.updater.update([], [s1, s2, s3], function (uri, success, errorBody) {
|
|
493
497
|
if (!success) {
|
|
494
498
|
console.log('Error occurs while editing ' + s1 + '\n\n' + errorBody);
|
|
495
499
|
outline.UserInput.deleteTriple(trCache.lastChild, true); // @@@@ This
|
|
@@ -500,12 +504,10 @@ module.exports = function UserInput(outline) {
|
|
|
500
504
|
return;
|
|
501
505
|
}
|
|
502
506
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
_solidLogic.store.add(s.subject, selectedPredicate, textTerm, s.why); // was: newStat =
|
|
507
|
+
kb.remove(s);
|
|
508
|
+
kb.add(s.subject, selectedPredicate, textTerm, s.why); // was: newStat =
|
|
506
509
|
// a subtle bug occurs here, if foaf:nick hasn't been dereferneced,
|
|
507
510
|
// this add will cause a repainting
|
|
508
|
-
|
|
509
511
|
}
|
|
510
512
|
|
|
511
513
|
var enclosingTd = UI.utils.ancestor(this.lastModified.parentNode.parentNode, 'TD');
|
|
@@ -517,7 +519,7 @@ module.exports = function UserInput(outline) {
|
|
|
517
519
|
});
|
|
518
520
|
outline.walk('right', outline.focusTd); // </Feature>
|
|
519
521
|
} else {
|
|
520
|
-
this.fillInRequest('object', this.lastModified.parentNode,
|
|
522
|
+
this.fillInRequest('object', this.lastModified.parentNode, kb.literal(this.lastModified.value));
|
|
521
523
|
return; // The new Td is already generated by fillInRequest, so it's done.
|
|
522
524
|
}
|
|
523
525
|
|
|
@@ -537,8 +539,7 @@ module.exports = function UserInput(outline) {
|
|
|
537
539
|
|
|
538
540
|
return;
|
|
539
541
|
} else if (s.predicate.termType === 'Collection') {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
+
kb.removeMany(s.subject);
|
|
542
543
|
var upperTr = UI.utils.ancestor(UI.utils.ancestor(this.lastModified, 'TR').parentNode, 'TR');
|
|
543
544
|
preStat = upperTr.AJAR_statement;
|
|
544
545
|
reqTerm = this.generateRequest('(To be determined. Re-type of drag an object onto this field)');
|
|
@@ -570,7 +571,7 @@ module.exports = function UserInput(outline) {
|
|
|
570
571
|
if (!this.statIsInverse) {
|
|
571
572
|
// this is for an old feature
|
|
572
573
|
// outline.replaceTD(outline.outlineObjectTD(s.object, defaultpropview),trNode.lastChild);
|
|
573
|
-
outline.replaceTD(outline.outlineObjectTD(
|
|
574
|
+
outline.replaceTD(outline.outlineObjectTD(kb.literal(this.lastModified.value), defaultpropview), trNode.lastChild);
|
|
574
575
|
} else {
|
|
575
576
|
outline.replaceTD(outline.outlineObjectTD(s.subject, defaultpropview), trNode.lastChild);
|
|
576
577
|
}
|
|
@@ -599,12 +600,12 @@ module.exports = function UserInput(outline) {
|
|
|
599
600
|
|
|
600
601
|
var s = this.getStatementAbout(selectedTd);
|
|
601
602
|
|
|
602
|
-
if (!isBackOut && !
|
|
603
|
-
!
|
|
603
|
+
if (!isBackOut && !kb.whether(s.object, rdf('type'), UI.ns.link('Request')) && // Better to check whether provenance is internal?
|
|
604
|
+
!kb.whether(s.predicate, rdf('type'), UI.ns.link('Request')) && !kb.whether(s.subject, rdf('type'), UI.ns.link('Request'))) {
|
|
604
605
|
UI.log.debug('about to send SPARQLUpdate');
|
|
605
606
|
|
|
606
607
|
try {
|
|
607
|
-
|
|
608
|
+
UI.store.updater.update([s], [], function (uri, success, errorBody) {
|
|
608
609
|
if (success) {
|
|
609
610
|
removefromview();
|
|
610
611
|
} else {
|
|
@@ -613,7 +614,6 @@ module.exports = function UserInput(outline) {
|
|
|
613
614
|
selectedTd.className = selectedTd.className.replace(/ pendingedit/g, '');
|
|
614
615
|
}
|
|
615
616
|
});
|
|
616
|
-
|
|
617
617
|
selectedTd.className += ' pendingedit';
|
|
618
618
|
} catch (e) {
|
|
619
619
|
UI.log.error(e);
|
|
@@ -728,13 +728,13 @@ module.exports = function UserInput(outline) {
|
|
|
728
728
|
var isInverse = selectedTd.parentNode.AJAR_inverse;
|
|
729
729
|
|
|
730
730
|
if (!isInverse) {
|
|
731
|
-
insertTr.AJAR_statement =
|
|
731
|
+
insertTr.AJAR_statement = kb.add(preStat.subject, preStat.predicate, term, preStat.why);
|
|
732
732
|
} else {
|
|
733
|
-
insertTr.AJAR_statemnet =
|
|
733
|
+
insertTr.AJAR_statemnet = kb.add(term, preStat.predicate, preStat.object, preStat.why);
|
|
734
734
|
}
|
|
735
735
|
|
|
736
736
|
try {
|
|
737
|
-
|
|
737
|
+
UI.store.updater.update([], [insertTr.AJAR_statement], function (uri, success, errorBody) {
|
|
738
738
|
if (!success) {
|
|
739
739
|
UI.log.error('userinput.js (pred selected): Fail trying to insert statement ' + insertTr.AJAR_statement + ': ' + errorBody);
|
|
740
740
|
}
|
|
@@ -818,14 +818,14 @@ module.exports = function UserInput(outline) {
|
|
|
818
818
|
?pred rdfs:domain ?subjectClass.
|
|
819
819
|
}
|
|
820
820
|
*/
|
|
821
|
-
subject = UI.utils.getAbout(
|
|
822
|
-
subjectClass =
|
|
821
|
+
subject = UI.utils.getAbout(kb, UI.utils.ancestor(selectedTd, 'TABLE').parentNode);
|
|
822
|
+
subjectClass = kb.any(subject, rdf('type'));
|
|
823
823
|
sparqlText = [];
|
|
824
824
|
var endl = '.\n';
|
|
825
825
|
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
826
|
|
|
827
827
|
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
|
-
sparqlText[2] = 'SELECT ?pred WHERE{\n' + subject + rdf('type') +
|
|
828
|
+
sparqlText[2] = 'SELECT ?pred WHERE{\n' + subject + rdf('type') + kb.variable('subjectClass') + endl + kb.variable('pred') + UI.ns.rdfs('domain') + kb.variable('subjectClass') + endl + '}';
|
|
829
829
|
predicateQuery = sparqlText.map($rdf.SPARQLToQuery);
|
|
830
830
|
} else {
|
|
831
831
|
// ------selector
|
|
@@ -846,8 +846,8 @@ module.exports = function UserInput(outline) {
|
|
|
846
846
|
?pred rdfs:domain ?subjectClass.
|
|
847
847
|
?pred rdfs:range ?objectClass.
|
|
848
848
|
*/
|
|
849
|
-
subject = UI.utils.getAbout(
|
|
850
|
-
subjectClass =
|
|
849
|
+
subject = UI.utils.getAbout(kb, UI.utils.ancestor(selectedTd, 'TABLE').parentNode);
|
|
850
|
+
subjectClass = kb.any(subject, rdf('type'));
|
|
851
851
|
var object = selectedTd.parentNode.AJAR_statement.object; // var objectClass = (object.termType === 'Literal') ? UI.ns.rdfs('Literal') : kb.any(object, rdf('type'))
|
|
852
852
|
// var sparqlText="SELECT ?pred WHERE{\n?pred "+rdf('type')+rdf('Property')+".\n"+
|
|
853
853
|
// "?pred "+UI.ns.rdfs('domain')+subjectClass+".\n"+
|
|
@@ -868,7 +868,7 @@ module.exports = function UserInput(outline) {
|
|
|
868
868
|
// objectTd
|
|
869
869
|
var predicateTerm = selectedTd.parentNode.AJAR_statement.predicate;
|
|
870
870
|
|
|
871
|
-
if (
|
|
871
|
+
if (kb.whether(predicateTerm, rdf('type'), UI.ns.owl('DatatypeProperty')) || predicateTerm.termType === 'Collection' || kb.whether(predicateTerm, UI.ns.rdfs('range'), UI.ns.rdfs('Literal'))) {
|
|
872
872
|
selectedTd.className = '';
|
|
873
873
|
UI.utils.emptyNode(selectedTd);
|
|
874
874
|
this.lastModified = this.createInputBoxIn(selectedTd, ' (Please Input) ');
|
|
@@ -933,7 +933,7 @@ module.exports = function UserInput(outline) {
|
|
|
933
933
|
if (menu.lastHighlight) menu.lastHighlight.className = '';
|
|
934
934
|
menu.lastHighlight = item;
|
|
935
935
|
menu.lastHighlight.className = 'activeItem';
|
|
936
|
-
outline.showURI(UI.utils.getAbout(
|
|
936
|
+
outline.showURI(UI.utils.getAbout(kb, menu.lastHighlight));
|
|
937
937
|
}
|
|
938
938
|
|
|
939
939
|
if (enterEvent) {
|
|
@@ -1005,7 +1005,7 @@ module.exports = function UserInput(outline) {
|
|
|
1005
1005
|
return 'asGivenTxt';
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
|
-
var inputTerm = UI.utils.getAbout(
|
|
1008
|
+
var inputTerm = UI.utils.getAbout(kb, menu.lastHighlight);
|
|
1009
1009
|
var fillInType = mode === 'predicate' ? 'predicate' : 'object';
|
|
1010
1010
|
outline.UserInput.clearMenu();
|
|
1011
1011
|
outline.UserInput.fillInRequest(fillInType, InputBox.parentNode, inputTerm); // if (outline.UserInput.fillInRequest(fillInType,InputBox.parentNode,inputTerm))
|
|
@@ -1131,7 +1131,7 @@ module.exports = function UserInput(outline) {
|
|
|
1131
1131
|
|
|
1132
1132
|
qp('at end of handler\n^^^^^^^^^^^^^^^^^\n\n');
|
|
1133
1133
|
setHighlightItem(menu.firstChild.firstChild);
|
|
1134
|
-
outline.showURI(UI.utils.getAbout(
|
|
1134
|
+
outline.showURI(UI.utils.getAbout(kb, menu.lastHighlight));
|
|
1135
1135
|
return 'nothing to return';
|
|
1136
1136
|
}
|
|
1137
1137
|
}; // end of return function
|
|
@@ -1252,9 +1252,9 @@ module.exports = function UserInput(outline) {
|
|
|
1252
1252
|
if (selectedTd.nextSibling) return 'predicate';
|
|
1253
1253
|
var predicateTerm = this.getStatementAbout(selectedTd).predicate; // var predicateTerm=selectedTd.parentNode.AJAR_statement.predicate;
|
|
1254
1254
|
|
|
1255
|
-
if (
|
|
1255
|
+
if (kb.whether(predicateTerm, UI.ns.rdf('type'), UI.ns.owl('DatatypeProperty')) || kb.whether(predicateTerm, UI.ns.rdfs('range'), UI.ns.rdfs('Literal')) || predicateTerm.termType === 'Collection') {
|
|
1256
1256
|
return 'DatatypeProperty-like';
|
|
1257
|
-
} else if (
|
|
1257
|
+
} else if (kb.whether(predicateTerm, rdf('type'), UI.ns.owl('ObjectProperty'))) {
|
|
1258
1258
|
return 'ObjectProperty-like';
|
|
1259
1259
|
} else {
|
|
1260
1260
|
return 'no-idea';
|
|
@@ -1310,9 +1310,7 @@ module.exports = function UserInput(outline) {
|
|
|
1310
1310
|
outline.UserInput.clearMenu();
|
|
1311
1311
|
var selectedTd = outline.getSelection()[0];
|
|
1312
1312
|
var targetdoc = selectedTd.parentNode.AJAR_statement.why;
|
|
1313
|
-
|
|
1314
|
-
var newTerm = _solidLogic.store.nextSymbol(targetdoc);
|
|
1315
|
-
|
|
1313
|
+
var newTerm = kb.nextSymbol(targetdoc);
|
|
1316
1314
|
outline.UserInput.fillInRequest('object', selectedTd, newTerm); // selection is changed
|
|
1317
1315
|
|
|
1318
1316
|
outline.outlineExpand(outline.getSelection()[0], newTerm);
|
|
@@ -1338,7 +1336,7 @@ module.exports = function UserInput(outline) {
|
|
|
1338
1336
|
if (this.value !== tiptext) {
|
|
1339
1337
|
var newuri = this.value; // @@ Removed URI "fixup" code
|
|
1340
1338
|
|
|
1341
|
-
This.fillInRequest('object', selectedTd,
|
|
1339
|
+
This.fillInRequest('object', selectedTd, kb.sym(newuri));
|
|
1342
1340
|
}
|
|
1343
1341
|
|
|
1344
1342
|
}
|
|
@@ -1401,7 +1399,7 @@ module.exports = function UserInput(outline) {
|
|
|
1401
1399
|
return insertTr;
|
|
1402
1400
|
},
|
|
1403
1401
|
bnode2symbol: function bnode2symbol(bnode, symbol) {
|
|
1404
|
-
|
|
1402
|
+
kb.copyTo(bnode, symbol, ['two-direction', 'delete']);
|
|
1405
1403
|
},
|
|
1406
1404
|
generateRequest: function generateRequest(tipText, trNew, isPredicate, notShow) {
|
|
1407
1405
|
var trNode;
|
|
@@ -1546,8 +1544,7 @@ module.exports = function UserInput(outline) {
|
|
|
1546
1544
|
|
|
1547
1545
|
if (target.childNodes.length === 2 && target.nextSibling) {
|
|
1548
1546
|
// Yes
|
|
1549
|
-
|
|
1550
|
-
|
|
1547
|
+
kb.add(bnodeTerm, IDpredicate, IDterm); // used to connect the two
|
|
1551
1548
|
|
|
1552
1549
|
outline.UserInput.clearMenu();
|
|
1553
1550
|
} else if (target.childNodes.length === 2) {
|
|
@@ -1563,7 +1560,7 @@ module.exports = function UserInput(outline) {
|
|
|
1563
1560
|
|
|
1564
1561
|
selectItem = function selectItem(e) {
|
|
1565
1562
|
qp('LIMITED P SELECT ITEM!!!!');
|
|
1566
|
-
var selectedPredicate = UI.utils.getAbout(
|
|
1563
|
+
var selectedPredicate = UI.utils.getAbout(kb, UI.utils.getTarget(e));
|
|
1567
1564
|
var predicateChoices = clickedTd.parentNode.AJAR_statement.predicate.elements;
|
|
1568
1565
|
|
|
1569
1566
|
for (var i = 0; i < predicateChoices.length; i++) {
|
|
@@ -1597,7 +1594,7 @@ module.exports = function UserInput(outline) {
|
|
|
1597
1594
|
|
|
1598
1595
|
selectItem = function selectItem(e) {
|
|
1599
1596
|
qp('WOOHOO');
|
|
1600
|
-
var inputTerm = UI.utils.getAbout(
|
|
1597
|
+
var inputTerm = UI.utils.getAbout(kb, UI.utils.getTarget(e));
|
|
1601
1598
|
qp('GENERAL SELECT ITEM!!!!!!=' + inputTerm);
|
|
1602
1599
|
qp('target=' + UI.utils.getTarget(e));
|
|
1603
1600
|
|
|
@@ -1631,7 +1628,7 @@ module.exports = function UserInput(outline) {
|
|
|
1631
1628
|
|
|
1632
1629
|
var NameSpaces = {}; // for each (ontology in ontologies)
|
|
1633
1630
|
|
|
1634
|
-
|
|
1631
|
+
kb.each(undefined, UI.ns.rdf('type'), UI.ns.owl('Ontology')).forEach(function (ontology) {
|
|
1635
1632
|
var label = UI.utils.label(ontology);
|
|
1636
1633
|
if (!label) return; // this is like extracting metadata from URI. Maybe it's better not to take the abbrevs.
|
|
1637
1634
|
|
|
@@ -1700,20 +1697,18 @@ module.exports = function UserInput(outline) {
|
|
|
1700
1697
|
var h1 = table.appendChild(myDocument.createElement('tr'));
|
|
1701
1698
|
var h1th = h1.appendChild(myDocument.createElement('th'));
|
|
1702
1699
|
h1th.appendChild(myDocument.createTextNode('Did you mean...'));
|
|
1703
|
-
|
|
1704
|
-
var plist = _solidLogic.store.statementsMatching(dialogTerm);
|
|
1705
|
-
|
|
1700
|
+
var plist = kb.statementsMatching(dialogTerm);
|
|
1706
1701
|
var i;
|
|
1707
1702
|
|
|
1708
1703
|
for (i = 0; i < plist.length; i++) {
|
|
1709
|
-
if (
|
|
1704
|
+
if (kb.whether(plist[i].predicate, rdf('type'), UI.ns.owl('InverseFunctionalProperty'))) {
|
|
1710
1705
|
break;
|
|
1711
1706
|
}
|
|
1712
1707
|
}
|
|
1713
1708
|
|
|
1714
1709
|
var _IDpredicate = plist[i].predicate;
|
|
1715
1710
|
|
|
1716
|
-
var _IDterm =
|
|
1711
|
+
var _IDterm = kb.any(dialogTerm, plist[i].predicate);
|
|
1717
1712
|
|
|
1718
1713
|
var text = UI.utils.label(dialogTerm) + ' who has ' + UI.utils.label(_IDpredicate) + ' ' + _IDterm + '?';
|
|
1719
1714
|
var h2 = table.appendChild(myDocument.createElement('tr'));
|
|
@@ -1747,7 +1742,7 @@ module.exports = function UserInput(outline) {
|
|
|
1747
1742
|
tempQuery.vars = [];
|
|
1748
1743
|
tempQuery.vars.push('Kenny');
|
|
1749
1744
|
var tempBinding = {};
|
|
1750
|
-
tempBinding.Kenny =
|
|
1745
|
+
tempBinding.Kenny = kb.fromNT(predicates[_i].NT);
|
|
1751
1746
|
|
|
1752
1747
|
try {
|
|
1753
1748
|
addPredicateChoice(tempQuery)(tempBinding);
|
|
@@ -1842,15 +1837,12 @@ module.exports = function UserInput(outline) {
|
|
|
1842
1837
|
console.log('testing searching text= ' + inputText + ' =====\n');
|
|
1843
1838
|
console.log('\n===start JournalTitleAutoComplete\n'); // Gets all the URI's with type Journal in the knowledge base
|
|
1844
1839
|
|
|
1845
|
-
var juris =
|
|
1846
|
-
|
|
1840
|
+
var juris = kb.each(undefined, rdf('type'), bibo('Journal'));
|
|
1847
1841
|
var matchedtitle = []; // debugging display before inserts into menu
|
|
1848
1842
|
|
|
1849
1843
|
for (var _i4 = 0; _i4 < juris.length; _i4++) {
|
|
1850
1844
|
var juri = juris[_i4];
|
|
1851
|
-
|
|
1852
|
-
var jtitle = _solidLogic.store.each(juri, dcelems('title'), undefined);
|
|
1853
|
-
|
|
1845
|
+
var jtitle = kb.each(juri, dcelems('title'), undefined);
|
|
1854
1846
|
var jtstr = jtitle + '';
|
|
1855
1847
|
var matchstr = inputText.toLowerCase();
|
|
1856
1848
|
var jTitleLowerCase = jtstr.toLowerCase(); // If the inputText as a whole is contained in a journal title
|
|
@@ -1879,12 +1871,11 @@ module.exports = function UserInput(outline) {
|
|
|
1879
1871
|
|
|
1880
1872
|
case 'LimitedPredicateChoice':
|
|
1881
1873
|
{
|
|
1882
|
-
var choiceTerm = UI.utils.getAbout(
|
|
1874
|
+
var choiceTerm = UI.utils.getAbout(kb, extraInformation.clickedTd); // because getAbout relies on kb.fromNT, which does not deal with
|
|
1883
1875
|
// the 'Collection' termType. This termType is ambiguous anyway.
|
|
1884
1876
|
|
|
1885
1877
|
choiceTerm.termType = 'Collection';
|
|
1886
|
-
|
|
1887
|
-
var choices = _solidLogic.store.each(choiceTerm, UI.ns.link('element'));
|
|
1878
|
+
var choices = kb.each(choiceTerm, UI.ns.link('element'));
|
|
1888
1879
|
|
|
1889
1880
|
for (var _i5 = 0; _i5 < choices.length; _i5++) {
|
|
1890
1881
|
addMenuItem(choices[_i5]);
|
|
@@ -1908,7 +1899,7 @@ module.exports = function UserInput(outline) {
|
|
|
1908
1899
|
switch (inputQuery.constructor.name) {
|
|
1909
1900
|
case 'Array':
|
|
1910
1901
|
for (var _i6 = 0; _i6 < inputQuery.length; _i6++) {
|
|
1911
|
-
|
|
1902
|
+
kb.query(inputQuery[_i6], addPredicateChoice(inputQuery[_i6]), nullFetcher);
|
|
1912
1903
|
}
|
|
1913
1904
|
|
|
1914
1905
|
break;
|
|
@@ -1918,8 +1909,7 @@ module.exports = function UserInput(outline) {
|
|
|
1918
1909
|
// break
|
|
1919
1910
|
|
|
1920
1911
|
default:
|
|
1921
|
-
|
|
1922
|
-
|
|
1912
|
+
kb.query(inputQuery, addPredicateChoice(inputQuery), nullFetcher);
|
|
1923
1913
|
}
|
|
1924
1914
|
}
|
|
1925
1915
|
}
|
|
@@ -1941,7 +1931,7 @@ module.exports = function UserInput(outline) {
|
|
|
1941
1931
|
|
|
1942
1932
|
var eventhandler;
|
|
1943
1933
|
|
|
1944
|
-
if (
|
|
1934
|
+
if (kb.any(reqTerm, UI.ns.link('onfillin'))) {
|
|
1945
1935
|
/* 2017 -- Not sure what is supposed to happen here -- timbl @@@@
|
|
1946
1936
|
eventhandler = function(subject) {
|
|
1947
1937
|
return kb.any(reqTerm, UI.ns.link('onfillin')).value)
|
|
@@ -1957,9 +1947,9 @@ module.exports = function UserInput(outline) {
|
|
|
1957
1947
|
var s = new UI.rdf.Statement(stat.subject, inputTerm, stat.object, stat.why);
|
|
1958
1948
|
|
|
1959
1949
|
try {
|
|
1960
|
-
|
|
1950
|
+
UI.store.updater.update([], [s], function (uri, success, errorBody) {
|
|
1961
1951
|
if (success) {
|
|
1962
|
-
newStat =
|
|
1952
|
+
newStat = kb.anyStatementMatching(stat.subject, inputTerm, stat.object, stat.why);
|
|
1963
1953
|
tr.AJAR_statement = newStat;
|
|
1964
1954
|
newTd.className = newTd.className.replace(/ pendingedit/g, '');
|
|
1965
1955
|
} else {
|
|
@@ -2001,7 +1991,7 @@ module.exports = function UserInput(outline) {
|
|
|
2001
1991
|
}
|
|
2002
1992
|
|
|
2003
1993
|
try {
|
|
2004
|
-
|
|
1994
|
+
UI.store.updater.update([], [_s], function (uri, success, _errorBody) {
|
|
2005
1995
|
UI.log.info('@@ usinput.js (object) callback ok=' + success + ' for statement:' + _s + '\n ');
|
|
2006
1996
|
var newStats;
|
|
2007
1997
|
|
|
@@ -2009,9 +1999,9 @@ module.exports = function UserInput(outline) {
|
|
|
2009
1999
|
_newTd.className = _newTd.className.replace(/ pendingedit/g, ''); // User feedback
|
|
2010
2000
|
|
|
2011
2001
|
if (!isInverse) {
|
|
2012
|
-
newStats =
|
|
2002
|
+
newStats = kb.statementsMatching(stat.subject, stat.predicate, inputTerm, stat.why);
|
|
2013
2003
|
} else {
|
|
2014
|
-
newStats =
|
|
2004
|
+
newStats = kb.statementsMatching(inputTerm, stat.predicate, stat.object, stat.why);
|
|
2015
2005
|
}
|
|
2016
2006
|
|
|
2017
2007
|
if (!newStats.length) {
|